[Tex/LaTex] Combining numbers and letters in equation numbering LaTeX

equationsnumbering

I currently have the following equation in LaTeX:

enter image description here

I'm trying to achieve the following in LaTeX:

equations in first part of section

The problem is that I can't seem to get the numbering to start at 1a. When I use the following code, it starts at 0a:

\renewcommand{\theequation}{\thesection\alph{equation}}

\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}

I've tried using

\setcounter{equation}{1}

But that line of code changes where the lettering starts (in this case with 0b).

EDIT: I already have 4 sections in my piece (document class apa); This piece of code is in the 4th section, so technically it would have to start at 4a.

Best Answer

You should use the subequations environment provided by amsmath for this.

MWE

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\section{1st subequation}

\begin{subequations}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{subequations}

\begin{subequations}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{subequations}

\section{2nd subequation}

\begin{subequations}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{subequations}

\section{No subequation}

\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}

\section{3rd subequation}

Here we want to start again from 4.
\setcounter{equation}{3}

\begin{subequations}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{subequations}

\end{document} 

Output:

enter image description here

Related Question