# How to align equations with amsmath in Latex

I am using the amsmath package to write equations in my latex document. But the equations are not aligned. How can I align them?

+1 vote
by (157k points)
selected by

You can use \begin{split} and \end{split} inside the equation. Use the ampersand character &, to set the points where the equations are vertically aligned.

\begin{split}
A & = \frac{\pi r^2}{2} \\
B & = \frac{1}{2} \pi r^2
\end{split}

You can also put your equations inside \begin{align} and \end{align} to align them vertically.

\begin{align*}
x - 4y &=  18 \\
2x + 7y &=  -22
\end{align*}

+1 vote