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

2 Answers 2

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

1
  • Great! It's exactly what I need! Thanks very much!
    – Dreamer
    Nov 22, 2016 at 12:52
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .