LatexNotes

Aligning equations in LaTeX

The amsmath align environments, align, align* and aligned, stack a sequence of equations one per line and line them up on a chosen point, almost always the equals sign, using an ampersand (&) as the alignment marker and \\ to end each line.

LaTeX command

\begin{aligned} a &= b \\ &= c \end{aligned}

Not the symbol you meant? Draw it to find the command →

Put the alignment marker & right before the symbol you want lined up, typically =. Each line after the first usually starts with &= so the equals signs form a column and only the right-hand side changes. This is the standard way to show a multi-step derivation or proof without repeating the left-hand side on every line.

align and align* are full display environments from amsmath, used on their own in a real document, and they auto-number each line unless you use align* or add \nonumber. aligned is the inline-friendly cousin: it never numbers anything and can sit inside a single display, inside cases, or inside equation, which makes it the safer default when embedding maths in other content.

Keep a line break (\\) at the end of every row except the last; a stray \\ with nothing after it, or a missing & on one row while other rows have one, throws the whole block out of alignment. If a line genuinely has no natural alignment point, just leave the & out of that row.

Other forms

\begin{align}...\end{align}numbered, display
\begin{align*}...\end{align*}unnumbered

Examples

$$\begin{aligned} (a+b)^2 &= a^2 + 2ab + b^2 \\ &= a^2 + b^2 + 2ab \end{aligned}$$

a step-by-step expansion aligned on =

$$\begin{aligned} f(x) &= x^2 - 4x + 4 \\ &= (x-2)^2 \end{aligned}$$

factoring shown step by step

$$\begin{aligned} x + y &= 5 \\ x - y &= 1 \end{aligned}$$

a small system aligned on =

$$\begin{aligned} P &\implies Q \\ Q &\implies R \end{aligned}$$

aligning a chain of implications

Tips and common mistakes

Working from handwritten notes?

LatexNotes turns a photo or PDF of handwritten mathematics into clean, compilable LaTeX - graphs and all. Free to try, no sign-up.

Convert your maths to LaTeX →

FAQ

What is the difference between align and aligned?

align is a standalone display environment that starts its own numbered equations; aligned is a sub-environment you place inside another display, such as a single maths block, cases, or equation, and it never numbers its lines on its own.

How do I stop align from numbering every line?

Use the starred form align*, or keep align and add \nonumber at the end of any individual line you don't want numbered, just before its \\.

Why is my alignment not lining up?

Check that every row places the & in the same relative position, for example always right before the =; one row with a missing or shifted & will pull the whole block out of column.

Can I align on something other than the equals sign?

Yes, the & can sit before any symbol, an inequality, an arrow such as \implies, or even a word inside \text{}, whatever you want the eye to track down the page.

See also