# Customise label in align environment

I'd like to slightly customise the label in the align environment. The need arises when I have two equations on the same line, and I would like to label them (1a,b) or similar. The example below works as expect when I use the equation environment, in that it labels the equations (1a,b) and (2a,b) which is what I want. However, if I replace the equation environment by the align environment my customisations have no effect. My customisations in equation environment are:

\renewcommand{\theequation}{\arabic{equation}a,b}


and

\renewcommand{\theequation}{\arabic{\theparentequation{a,b}}


But these have no effect in align environment. What are their equivalents? Specifically, in the last example below, using align within the subequations environment, I'd like to label the equations (4a,b) and (4c,d) and (4e) where '4' is the automatically supplied equation number and 'a,b' and 'c,d' and 'e' are my manual additions. Here is the MWE:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\subsubsection*{Using equation}
\textit{Case 1:}  works as expected
$$\renewcommand{\theequation}{\arabic{equation}a,b} a = b, \qquad b = c$$
\textit{Case 2:} still works, but the alignment cannot be adjusted.
\begin{subequations}
$$\renewcommand{\theequation}{\theparentequation{a,b}} a = b, \qquad b = c$$
$$\renewcommand{\theequation}{\theparentequation{c,d}} d = f = h, \qquad f = g$$
\end{subequations}

\subsubsection*{Using align}
The following cases do not work in the same way using the align environment. \\
\textit{Case 3:} This case is fine, but doesn't
help as I could do the same thing with the equation environment.
\begingroup
\renewcommand{\theequation}{\arabic{equation}a,b}
\begin{align}
a = b, \qquad b = c
\end{align}
\endgroup
\textit{Case 4:} Now here is the case that I want to work, but it does not.
I would like it to label the three equations (4a,b), (4c,d) and (4e)
\begin{subequations}
\begingroup
\renewcommand{\theequation}{\theparentequation{a,b}}
\begin{align}
a = b, \qquad & b = c \\
\renewcommand{\theequation}{\theparentequation{c,d}}
d = f = h, \qquad & f = g \\
\renewcommand{\theequation}{\theparentequation{e}}
& g = h
\end{align}
\endgroup
\end{subequations}
\end{document}


I suggest to use subequations, together with a new command:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\newcommand{\subtag}[1]{\tag{\theparentequation#1}}

Here is first a single equation
\begin{subequations}
$$a = b, \qquad b = c \subtag{a,b}$$
and then an alignment
\begin{gather}
\begin{align}
a &= b,     & b = c \subtag{c,d}\\
d &= f = h, & f = g \subtag{e,f}
\end{align}\\
g = h \subtag{g}
\end{gather}
\end{subequations}

\end{document}


• That works well, and I have accepted the answer. I also learned you can put an align environment insider a gather environment, which I had never thought of doing. Thanks also to @barbara beeton for making me clarify my question which led to the answer. (P.S. How does one tag a name with a space, like barbara beeton? Seems like I just tagged some other user called barbara.) – GeoffV Nov 12 '17 at 20:06
• @GeoffV Just remove all spaces. – egreg Nov 12 '17 at 20:15
• Duh. Should have known. – GeoffV Nov 12 '17 at 20:47

in the case of align, this doesn't work because each cell of an align is a distinct local group, and the new definition doesn't persist outside that group.

if you reset the definition before \begin{align} it would have the effect you are looking for, but unfortunately, it won't disappear automatically after that block so you have to isolate it, by putting the whole block between either braces or \begingroup ... \endgroup.

the situation is somewhat similar (although more complicated) in the subequations case. actually, since a subequations group would gat a on the first line, b on the second, etc., what you say you expect isn't really what should be expected at all. what does happen, if you move the redefinition

\renewcommand{\theequation}{\theparentequation{a,b}}


outside the scope of the align, the counter applied will be the last previous value of \theparentequation, not the next logical value of the equation counter, and the assigned label will further be followed by "a", for "(Na,ba)" which is not at all what you want.

i'm not convinced that you really want to use align with such a modified subequations counter and labels, but perhaps you have a reason to use this in an "ordinary" align environment; i just don't know.

this does demonstrate yet another reason that align shouldn't be used for single-line displays.

• Many thanks. Indeed I don't want to use align for a single line equation. Rather, I'd like to use it in a multi-line case within subequations so that the successive equations are labelled (4a,b), 4(c,d), or similar. I've edited my question to make it clearer what I would like to happen. Following your reply I now understand why it doesn't work, but don't know how to make it work as desired. Perhaps there is a different way that I am missing? – GeoffV Nov 11 '17 at 8:32