1

I want to have an equation containing nested align environments, where each row is numbered like a subequation like 1a), 1b), 1c) etc.

I have the following code that does already almost what I want:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{subequations}
\begin{align}
A &+ 1 &&+ &&2 &&=C \\
B &+ 222 &&
\begin{aligned}[t]
&123 && + && 345 && - && 678 \\
&12 && - && 2
\end{aligned}  && && =D \\
E &+ 33 &&- &&5 &&=F
\end{align}
\end{subequations}
\end{document}

as it generates the following output:

enter image description here

However, I want the third line to be numbered with (1c), the fourth line should be (1d).

How can I achieve this?

2 Answers2

3

You could try to fool LaTeX by hiding the depth of the aligned and adding an empty line:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{subequations}
\begin{align}
A &+ 1 &&+ &&2 &&=C \\
B &+ 222 &&
\smash{\begin{aligned}[t]
&123 && + && 345 && - && 678 \\
&12 && - && 2
\end{aligned}}  && && =D \\
\\
E &+ 33 &&- &&5 &&=F
\end{align}
\end{subequations}
\end{document}

enter image description here

Ulrike Fischer
  • 327,261
3

Two aligned environments instead of a single one, and the small makebox package will do the trick:

\documentclass{article}

\usepackage{amsmath}
\usepackage{makebox}

\begin{document}

\begin{subequations}
\begin{align}
A &+ 1 &&+ &&2 &&=C \\
B &+ 222 &&
\begin{aligned}
&123 && + && 345 && - && 678
\end{aligned} && && =D\\
 & & &
 \begin{aligned}
&\makebox*{$123$}[l]{$ 12 $} && - && 2
\end{aligned}
 \\
E &+ 33 &&- &&5 &&=F
\end{align}
\end{subequations}

\end{document} 

enter image description here

Bernard
  • 271,350