0

I have a trouble with this code:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{equation}
\begin{split}
a&=b+c\\&
\begin{split}
=c+d+e&\qquad\text{this is}\\
=f+g&\qquad\text{this is}\\
=h.
\end{split}
\end{split}
\end{equation}

\begin{equation}
\begin{split}
a&=b+c\qquad\text{this is}\\
&=f+g\qquad\text{this is}\\
&=h.
\end{split}
\end{equation}

\end{document}

My problem is this: In first equation the =-signs are not left-aligned, and I'd like to have something like the second equation, keeping \text{this is} in the same alignment of last equation. I hope my question is clear. Thank you so much in advanced.

2
  • Do you believe you can nest split inside split? Well, unbelieve it.
    – egreg
    May 7, 2023 at 20:35
  • @egreg Doesn't exist a solution for my problem? If the answer is negative, how could I solv my problem?, this is, does exist a sort of split-alignment that uses two & in the same line?
    – Puck
    May 7, 2023 at 20:37

1 Answer 1

2

You get no error from nesting split inside split, but no good output either.

You can use alignedat instead of split.

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{equation}
\begin{alignedat}{2}
a &= b+c\\
  &= c+d+e &\qquad& \text{this is} \\
  &= f+g   &&       \text{this is} \\
  &= h.
\end{alignedat}
\end{equation}

\end{document}

Or, more simply, aligned.

enter image description here

You must log in to answer this question.

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