I have a series of equations aligned at =
inside a split
environment. (They're all actually the same equation, so the left-hand-side is missing in all but the first equation.)
Unfortunately the last equation is super long and doesn't fit into a single line. It needs to be split. I don't what the convention is, but I'd say it should be right-aligned. How do you do this?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{split}
x &= a + a \\
&= b + b + b + b \\
&= c + c + c + c + c + c + c + c + c + c + c + c \\
% obviously does not work
\hfill + c + c + c + c + c + c + c + c + c + c
\end{split}
\]
\end{document}
Best Answer
You can make use of
mathtools
'multlined
environment:Note: the
\!
before the environment is to get correct spacing between=
andc
.It's also possible to specify the total width of the two lines (from left margin at first line to right margin at last line) as an optional argument to
multlined
:If you want the two lines right aligned, you can set the
mathtools
keyfirstline-afterskip
to0pt
, either globally or locally: