# How to align equation items below their =

How is it possible to sort equations align with their = like this:

a*b*c = d*e*f
g*h = i*j
k = l*m*n
o*p*q = r


I've seen it before but I don't know how to find that!

• I found something like want I seek in this answer tex.stackexchange.com/questions/43536/… but not sure if it's the answer. – sajjadG Aug 5 '13 at 14:37
• Are your asking for alignment of equations? Standard latex has eqnarray, which is better replaced by the align from amsmath. – Andrew Swann Aug 5 '13 at 14:37
• Take a look at Stefan Kottwitz's blog post at texblog.net/latex-archive/maths/eqnarray-align-environment, which compares different methods of aligning equations (in a nutshell: use \begin{align} with \usepackage{amsmath}) – Jake Aug 5 '13 at 14:38
• The word align is the right word. The amsmath package provides the align environment (amongst others). Insert an ampersand & before every = and add \\ after every line and you’re good to go. For more, check the amsmath manual or the align tag. – Qrrbrbirlbel Aug 5 '13 at 14:38
• @AndrewSwann yes alignment was what I was looking for. thanks for mentioning eqnarry.@Jake Thanks man. The link was awesome. nothings better than a simple example which was on that site.@Qrrbrbirlbel Thanks you. you mentioned the pitfalls. very good. Thanks all you guys I solved my problem with your comments. – sajjadG Aug 5 '13 at 14:52

You're looking for the align environment which is provided by amsmath.

In the code below, an ampersand (&) denotes a vertical alignment point. Every line in the align environment will be aligned such that all ampersands are vertically aligned.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
a*b*c &= d*e*f\\
g*h &= i*j\\
k &= l*m*n\\
o*p*q &= r% \\ is not needed in this line!
\end{align}

\end{document}


If you need equation numbers, there are 2 options as follows.

## An equation number for each line

\documentclass[preview,border=10pt]{standalone}% change it back to
%\documentclass{article}

\usepackage{amsmath}

\begin{document}
\abovedisplayskip=0pt\relax% for my own purpose, remove this line!

\begin{align}
a*b*c &= d*e*f\\
g*h &= i*j\\
k &= l*m*n\\
o*p*q &= r% no \\ in this line!
\end{align}

\end{document}


## An equation number for the whole as a group

\documentclass[preview,border=10pt]{standalone}% change it back to
%\documentclass{article}

\usepackage{amsmath}

\begin{document}
\abovedisplayskip=0pt\relax% for my own purpose, remove this line!

$$\begin{split} a*b*c &= d*e*f\\ g*h &= i*j\\ k &= l*m*n\\ o*p*q &= r% no \\ in this line! \end{split}$$

\end{document}


But if you don't need equation numbers, replace align with align* or equation with equation*. $...$ can also be used for the latter case!

• For the latter equation + split is better. aligned is for inline mode (not inline math-mode but inline alignment). See also this answer of mine. And no, I have no better source to support that. – Qrrbrbirlbel Aug 23 '13 at 9:00
• To handle the case of a single number for the entire set of equations for which only one alignment point is needed, I'd say you're better off using the split environment instead of the aligned environment. – Mico Aug 23 '13 at 9:11