Multiple alignments
You could use alignat
which is also from the amsmath
package.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
f(x)&=eqn1 && \\
&=eqn2_part1 && +eqn2_part2 \\
& && +eqn2_part3\\
&=eqn3 && \\
&=eqn4 && \\
\end{alignat*}
\end{document}
You'll notice that the alignat
environment takes an argument- which is (quoting from the documentation)
the number of “equation columns”: count the maximum number of &s in any row, add 1 and divide by 2.
Using boxes via \phantom
is also an option, if alignment characters like &&
get in the way for long equations:
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
f(x)&=\text{eqn}_1\\
&=\text{eqn}_2\text{-part}_1+\text{eqn}_2\text{-part}_2\\
&\phantom{{}=\text{eqn}_2\text{-part}_1}{}+\text{eqn}_2\text{-part}_3\\
&=\text{eqn}_3\\
&=\text{eqn}_4\\
\end{align*}
\end{document}
A correction for the spacing around binary operators ({}+
) and relations ({}=
) is required though. See Herbert's mathmode
document for more on AMS environments and alignment.