# equation labels inside a nested align and aligned environment

I'd like to have several equations aligned pair-wise in, essentially, two columns, but with individual labels for each equation and/or for each line (where one line displays two equations).

I have achieved the desired alignments by nesting aligned environments inside an align environment. I can also label the whole align environment. What about labeling the individual equations inside the aligned environment?

I'm looking for a solution that is not too hacky, if there is one. I'm not tied to align and aligned. It may be too cluttered to number each equation, but at least I'd like to label/number each line.

Thanks!

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

\begin{align}
\label{eq:myeq}
\begin{aligned}[c]
%  \label{eq:myeq:AB}
A & = B
\\
%  \label{eq:myeq:CD}
C & = D
\\
%  \label{eq:myeq:EF}
E & = F
\end{aligned}
\begin{aligned}[c]
%  \label{eq:myeq:ab}
a & = b
\\
%  \label{eq:myeq:cd}
c & = d
\\
%  \label{eq:myeq:ef}
e & = f
\,.
\end{aligned}
\end{align}

\end{document}


To see what I'm after, consider the following:

\begin{align}
\label{eq:myeq:ABab}
A & = B &&             & a & = b
\\
\label{eq:myeq:CDcd}
C & = D && \Rightarrow & c & = d
\\
\label{eq:myeq:EFef}
E & = F &&             & e & = f
\end{align}


This produces the desired result for odd-numbered equations, but not for even-numbered equations. And also I prefer to see the equations "split" as they are in my first code, as it's easier to read.

-
How do you want to align the numbering of both equations (on the same line)? Could you include a mockup of the expected output? – Werner Aug 14 '13 at 21:57
The best is probably to have numbers (1), (2), and (3) aligned with each line horizontally and located vertically where the number (1) currently is, that is on the right-hand side. – PatrickT Aug 14 '13 at 22:54
But I thought you wanted all six of your equations (3 rows) numbered above? – Werner Aug 14 '13 at 23:04
I mentioned two possibilities: either every equation with a number (but that, Ian suggested, might be too cluttered and/or confusing to readers) or every line/row with a number, so an equation could be referred to as the left-hand side of (1) or the right-hand side of (1), for instance. – PatrickT Aug 15 '13 at 1:12
Sorry to Ian and John below for not yet accepting an answer. Neither provide a simple and automatic way for the implication sign to align itself properly. Too much tweaking appears to be needed. Perhaps it is one of those questions without an answer... But a big thank you to you! – PatrickT Aug 19 '13 at 19:36

You can number each line using the alignat environment from the amsmath package.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{2}
e &= f &  g &= h
\end{alignat}
\end{document}


You can use \nonumber to suppress numbering on individual lines. I don't think it would be a good idea to separately number the equations in the left-hand column. Readers expecting to find the equation numbers at the edge of the page are likely to find this annoying.

-
Thanks Ian. Agreed about \nonumber and agreed that numbers on the left-hand side would be ugly. However, I'd like a single \Rightarrow aligned in the middle vertically. Also, I'm using align for all my equations and would like the spacing to be consistent, if possible. Hope I don't sound too ungrateful! Cheers Ian. – PatrickT Aug 14 '13 at 23:01
@PatrickT --- I'll have to think about the case where you have an even number of rows. Time to sleep now, though! – Ian Thompson Aug 14 '13 at 23:25
@IanThompson: Use something like \smash{\raisebox{-.5\baselineskip}{$\Rightarrow$}}... – Werner Aug 14 '13 at 23:43
In my real-life situation I have 2 X 5 = 10 equations, but ideally I would want to be able to comment out one line and not have to hack the position of \Rightarrow ... Thanks for your suggestions! – PatrickT Aug 15 '13 at 1:16
@PatrickT --- I think it's going to be very difficult to get everything you want in this case. Therefore I would be inclined to use alignat along with Werner's suggestion for the arrow, unless you have a very large number of these structures. – Ian Thompson Aug 15 '13 at 15:39

You can replace the \framebox with a \makebox, but I wanted so see how things were fitting in the space. You can play with the \parbox widths, but you will always get a big gap on the left side of the equations.

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

\noindent
\framebox[\textwidth]{
\parbox{1.5in}{
\begin{align}
A&=B\\
C&=D\\
E&=F
\end{align}}
\hfill$\Rightarrow$\hfill
\parbox{1.5in}{
\begin{align}
a&=b\\
c&=d\\
e&=f
\end{align}}
}

\end{document}

-
Thanks John. This is pretty neat, exactly the rendering I had in mind initially, i.e. with labels for all equations. Getting the correct proportions is fiddly though. Why isn't there a way to push the lhs column more to the left to use the full width of the page? Thanks! – PatrickT Aug 15 '13 at 23:22
I used the default margins for the MWE. It will expand to whatever page width you set. – John Kormylo Aug 16 '13 at 14:48
Thanks John... I must be doing something wrong, I'll try again. – PatrickT Aug 19 '13 at 8:52