[Tex/LaTex] Missing $ inserted error when using \frac inside subequations environment

amsmath

Here's a MNWE (minimum not working example):

\documentclass[12pt,letterpaper]{article}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}

\section{Hello World}
    \begin{subequations}
        \frac{a}{b} = 0 \\
    \end{subequations}

\end{document}

The errors:

line 12: Missing $ inserted \frac{a}{b}
line 12: Extra }, or forgotten $ \frac{a}{b}
line 13: Missing $ inserted \end{subequations}
line 13: Missing } inserted \end{subequations}

How do I fix the MNWE?

Best Answer

subeequations does not in itself start math math mode, but all numbered equations within it will be numbered as 1a, 1b, etc. The environment can also contain text.

\documentclass[12pt,letterpaper]{article}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}

\section{Hello World}
\begin{subequations}
Here is some text.
\begin{equation}
        \frac{a}{b} = 0
\end{equation}
Then follows some more text, followed by some more equations.
\begin{gather}
a=b \\
c = d
\end{gather}
\end{subequations}

The next equation is not part of the subequations.
\begin{equation}
g=h
\end{equation}
\end{document}

enter image description here