Multiline equation inside a split environment
You can make use of mathtools
' multlined
environment:
\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
\[
\begin{split}
x &= a + a \\
&= b + b + b + b \\
&= \!\begin{multlined}[t]
c + c + c + c + c + c + c + c + c + c + c + c \\
+ c + c + c + c + c + c + c + c + c + c
\end{multlined}
\end{split}
\]
\end{document}
Note: the \!
before the environment is to get correct spacing between =
and c
.
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
:
\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
\[
\begin{split}
x &= a + a \\
&= b + b + b + b \\
&= \!\begin{multlined}[t][10cm]
c + c + c + c + c + c + c + c + c + c + c + c \\
+ c + c + c + c + c + c + c + c + c + c
\end{multlined}
\end{split}
\]
\end{document}
If you want the two lines right aligned, you can set the mathtools
key firstline-afterskip
to 0pt
, either globally or locally:
\documentclass[border=5pt,preview]{standalone}
\usepackage{amsmath,mathtools}
\begin{document}
\mathtoolsset{firstline-afterskip=0pt}
\[
\begin{split}
x &= a + a \\
&= b + b + b + b \\
&= \!\begin{multlined}[t]
c + c + c + c + c + c + c + c + c + c + c + c \\
+ c + c + c + c + c + c + c + c + c + c
\end{multlined}
\end{split}
\]
\end{document}
The standard and easiest method is to just add a line to the split
and move right by, say, one quad. This is the method I'd prefer, not bothering about alignment.
Alternatively, use multlined
from mathtools
:
\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
\[
\begin{split}
x &= a + a \\
&= b + b + b + b \\
&= c + c + c + c + c + c + c + c + c + c + c + c \\
&\qquad + c + c + c + c + c + c + c + c + c + c
\end{split}
\]
\[
\begin{split}
x &= a + a \\
&= b + b + b + b \\
&= \mathtoolsset{firstline-afterskip=0pt}
\!\begin{multlined}[t] % <---- don't forget \!
c + c + c + c + c + c + c + c + c + c + c + c \\
+ c + c + c + c + c + c + c + c + c + c
\end{multlined}
\end{split}
\]
\end{document}
You could use a stack, for example. If the line heights were uniform, this would work:
\documentclass{article}
\usepackage{amsmath,stackengine}
\stackMath
\begin{document}
\[
\begin{split}
x &= a + a \\
&= b + b + b + b \\
&= \stackengine{\baselineskip}{c + c + c + c + c + c + c + c + c + c + c + c}
{{}+ c + c + c + c + c + c + c + c + c + c}{U}{r}{F}{F}{L}
\end{split}
\]
\end{document}
If the stacked rows were of non-standard heights, then this:
\documentclass{article}
\usepackage{amsmath,stackengine}
\stackMath
\begin{document}
\[
\begin{split}
x &= a + a \\
&= b + b + b + b \\
&= \stackengine{5pt}{c + c + c + c + \dfrac{a}{b} + c + c + c + c + c + c + c}
{{}+ c + \dfrac{c}{d} + c + c + c + c + c + c + c + c}{U}{r}{F}{F}{S}
\end{split}
\]
\end{document}
It is the 5th argument of \stackengine
, given by {r}
that defines the alignment of the stack. Other options are {l}
and {c}
.