-1

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.

enter image description here

Any comment will be appreciated. Thanks in advance.

Dreamer
  • 119

2 Answers2

2

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}

enter image description here

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}

enter image description here

Henri Menke
  • 109,596
2

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).

enter image description here

egreg
  • 1,121,712