# Arranging equations neatly in rows and columns with a single numeration for all

Say I want to write a set of equations in a systematic way, more like the ones in a matrix but without the matrix parenthesis on the left and right-hand sides.

More like:

A=1 A=2.5 C=8

B=9 B=0 A=2

B=9 H=2.2 F=3

But I want each of the letter to start on the same point. In the example that I have written the first column looks good, but the third column does not. In the third column I want the F to be perfectly under A and A to be perfectly under C. I have tried to put a certain "\hspace" between them but I got dizzy as I have many rows and columns and I want them to look neat. Please note that I can not put those in a table. I want them loose and now that we are at it, I only wonder if this can be done, how to numerate the whole data by one equation number on the right hand side? Maybe (3.12) beside the last row on the right-hand side or a big brace on the right hand side of all rows that say in the middle after the brace (3.12)?

One option would be to use aligned or alignedat from the amsmath package. A little example in which one variant has a brace at the right (I think the brace is not really needed); using the optional argument you can control the vertical position of the tag:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignedat}{3} A &= 1 & A &= 2.5 \qquad& C &= 1 \\ B &= 9 & B &= 1 & A &= 0 \\ B &= 1 \qquad& H &= 2.25 \qquad& F &= 0.23 \end{alignedat}

\begin{alignat}{3}
A &= 1 & A &= 2.5 \qquad& C &= 1\notag \\
B &= 9 & B &= 1 & A &= 0\notag \\
\end{alignat}

\left.\begin{alignedat}{3} A &= 1 & A &= 2.5 \qquad& C &= 1 \\ B &= 9 & B &= 1 & A &= 0 \\ B &= 1 \qquad& H &= 2.25 \qquad& F &= 0.23 \end{alignedat}\right\rbrace

\end{document}


• Is it my eyes, or is the vertical alignment of (2) somewhat off from the bottom row of the equation set? – Steven B. Segletes Aug 5 '15 at 18:34
• @StevenB.Segletes No, it was not your eyes, I had some spurious line-change commands that I've removed in my edit. Thanks for noticing this. – Gonzalo Medina Aug 5 '15 at 19:51

It is easy to to with alignedat and the empheq package. Needless to load amsmath since empheq loads mathtools, which loads amsmath. In the following code the columns are separated by 3 em.

I'm not sure whether you want to reset the equation counter at each new section, or simply add the section counter in front of the equation counter? I chose the first solution, with the help of the chngcntr package, but may be easily changed.

\documentclass{article}
\usepackage{chngcntr}
\counterwithin{equation}{section}

\begin{document}

\setcounter{section}{3}\setcounter{equation}{11}
[right =\enspace \empheqrbrace] \begin{alignedat}{5} A &= 1 & \hskip 3em & A & & = 2.5 & \hskip 3em & C & & = 8 \\ B &= 9 & & B & & = 0 & & A & & = 2 \\ B &= 9 & & H & & = 2.2 & & F & & = 3 \\ \end{alignedat}

\end{document}


• the equals signs in the second column aren't aligned; that's because the & precedes the letter rather than the equals sign in that column; similarly in the third column, but it isn't that noticeable because the three letters have very nearly the same width, while "H" is distinctly wider than "B". – barbara beeton Aug 5 '15 at 20:25
• @barbara beeton: Yes but the O.P. specified he wanted to align by the letters. Maybe I should use three more alignment groups… – Bernard Aug 5 '15 at 21:34
• Finally I've added two more alignment points. Of course the distance from the letters to the = sign isn't exactly the same. – Bernard Aug 5 '15 at 21:46

Perhaps one of these TABstack choices?? The intercolumn gap is set in the preamble to 1em, and the inter-row baseline skip is set there to 1.2\baselineskip. Both these values can be modified to suit.

\documentclass{article}
\usepackage{tabstackengine}
\stackMath
\setstacktabbedgap{1em}
\setstackaligngap{1em}
\setstackgap{L}{1.2\baselineskip}
\begin{document}
Here it is with bottom numbering aligned to the left of the subequation
$$\tabbedLongstack[l]{ A = 1 & A = 2.5 & C = 8 \\ B = 9 & B = 0 & A = 2\\ B = 9 & H = 2.2 & F = 3 }$$
or else aligned to the equal sign
\alignLongstack{ A =& 1 & A =& 2.5 & C =& 8 \\ B =& 9 & B =& 0 & A =& 2\\ B =& 9 & H =& 2.2 & F =& 3 }
and here it is with central numbering
$$\left. \tabbedCenterstack[l]{ A = 1 & A = 2.5 & C = 8 \\ B = 9 & B = 0 & A = 2\\ B = 9 & H = 2.2 & F = 3 } \quad\right\}$$
\end{document}


Note that I show two different alignments in eqs 1 and 2. In (1), I align to the left of the equation, whereas in (2), I align to the = sign. The OP sort of indicated a preference for (1), but (2) is somewhat standard.