Aligned equations in LaTeX
Several equations aligned at the = sign are written with the align environment. The & character marks the alignment point and \\ ends a row. align numbers every equation, align* numbers none.
Step-by-step derivation
\begin{aligned} (a+b)^2 &= (a+b)(a+b) \\ &= a^2 + 2ab + b^2 \end{aligned}Numbered equations in a document
\begin{align}
F &= ma \label{eq:newton} \\
E &= mc^2 \nonumber
\end{align}Common mistakes
- Nesting align inside $$...$$: align is already display math and fails inside $$.
- The old eqnarray environment: it leaves too much space around the equals sign.
See also
Don't want to memorize commands?
Draw a formula or paste a screenshot, and CamteX turns it into ready LaTeX.