The align environment provided by AMS-LaTeX is used for two or more equations when vertical alignment is desired; usually equal signs are aligned. Use ampersands (&) for alignment and a double backslash (\\) to insert a linebreak.
Example[]
Markup | \begin{align}
x-1 &= y \\
x &= y+1
\end{align}
|
Renders as |
It is even possible to use multiple alignment characters (&) per line:
Markup | \begin{align}
x-1 &= y & a &= b+c \\
x &= y+1 & a-c &= b
\end{align}
|
Renders as |
Markup | \begin{align}
\frac{d}{dx} \ln x &= \lim_{h\to 0} \frac{\ln(x+h) - \ln x}{h} \\
&= \ln e^{1/x} &&\text{How this follows is left as an exercise.}\\
&= \frac{1}{x} &&\text{Using the definition of ln as inverse function}
\end{align}
|
Renders as |
Preamble[]
To use align
, import the amsmath package in your preamble with \usepackage{amsmath}
.
See also[]
- flalign (bigger horizontal gaps, allows for left-aligning equations)
- alignat (smaller horizontal gaps)