math-mode – How to Use Nested Align without Extra Spacing in LaTeX

alignhorizontal alignmentmath-mode

I am trying to align the + symbols, while also aligning the = symbols, as such

enter image description here

As you can see, I managed to align at the ='s but not the +'s, how can I do that? This is the code I used (using quad to kind of align them):

                x &= a + b (ert)\\
            &\quad\quad + c(ert)\\
            &= abc

When I try something like this:

            x &= a &&+ b (ert)\\
            & &&+ c(ert)\\
            &= abc

I get this:
enter image description here

I also tried alignat, and split inside align, but nothing seems to do the trick.

Best Answer

You could use alignat but as you want the wrapped summation to overlap the abc on the last row, a nested aligned is better

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

alignat
\begin{alignat}{-1}
    x &= a &&+ b (ert)\\
      &    &&+ c(ert)\nonumber\\
      &= abc  
\end{alignat}

aligned
\begin{align}
    x &=\begin{aligned}[t]
         a &+ b (ert)\\
           &+ c(ert)
         \end{aligned}\\
      &= abc  
\end{align}

\end{document}
Related Question