How to code a terraced math formula in Latex, such as the following picture? What I really need is to align "C" with the first "+" in second line, "F" with the first "+" in third line.
Any comment will be appreciated. Thanks in advance.
You can use nested aligned
environments for that. (For an explanation of the \!
read Why is there a \, space at the beginning of the “aligned” environment?)
\documentclass{article}
\usepackage{mathtools} % loads amsmath
\begin{document}
\begin{align*}
A = B \{ & C + D \\
&\!\begin{aligned}[t]
{} + E [ & F + G \\
& + H ( I + J) ] \}
\end{aligned}
\end{align*}
\end{document}
But maybe you are rather looking for multline
. It’ll left-align the first line, right-align the last line and center all lines in between. In this case it looks very awkward because the lines are so short.
\documentclass{article}
\usepackage{mathtools} % loads amsmath
\begin{document}
\begin{multline*}
A = B \{ C + D \\
+ E [ F + G \\
+ H ( I + J) ] \}
\end{multline*}
\end{document}
Use proper nesting of environments:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
A = B \{ & C + D \\
& \negmedspace +
\!\begin{aligned}[t]
E[ & F + G \\
& \negmedspace + H(I+J)]\}
\end{aligned}
\end{align*}
\end{document}
With \negmedspace
we remove the space before the +
(which has to be inserted or the one after it would disappear).