# How can I nest alignment environments together and get different equations numbering for the nested alignments?

In the equation above, \Delta_{X{lm}} is taken as one equation by using split environment. I want to align the ranges shown in Eq. 1 which I already did, but I want each range to get its equation numbering as well, that is [\Xi \Theta] should be (1) and [\Theta \Xi] should be (2).

My source code

\documentclass[]{IEEEtran}

\usepackage{amsmath}
\usepackage{amssymb, amsfonts}

\DeclareRobustCommand{\chiup}{{\mathpalette\irchi\relax}}
\newcommand{\irchi}[2]{\raisebox{\depth}{$#1\chi$}}

\begin{document}

\begin{align}
\begin{split}
\Delta{X_{lm}} &= \left \{
\begin{aligned}
&\left[ \thinspace \Xi \quad \Theta \thinspace \right], &\chiup > 0
\\
&\left[ \thinspace \Theta \quad \Xi \thinspace \right], &\chiup < 0
\end{aligned}
\right.
\end{split}
\label{eq:del_Xlm_bnd}
\\
\intertext{where\vspace{0.3\baselineskip}}
\Xi &= \frac{\chiup}{X_{th,kp}}
\label{eq:eq:del_Xlm_bnd_Xi}
\\
\Theta &= \frac{\chiup}{X_{th,kp} - X_{b}}
\label{eq:eq:del_Xlm_bnd_Theta}
\end{align}

\end{document}

• numcases cannot be nested inside align environment – Al-Motasem Aldaoudeyeh Jul 21 '18 at 23:19
• After searching through different solutions, I came to the conclusion that this answer is probably what you want. As you already found out, numcases cannot be nested (and it breaks cross-referencing). Even this solution won’t work, because empheq breaks \intertext. – Ruixi Zhang Jul 21 '18 at 23:21

Since you mentioned in the comments that numcases from the cases package cannot be nested in align, this answer by @PeterGrill won’t work. Since you also want \intertext so that you can insert text without disrupting alignment points, this answer by @egreg won’t work either.

So here is a variant of this answer by @Werner which spares you from trial and error with @Bernard’s answer.

\documentclass{IEEEtran}

%\usepackage{amssymb}

\DeclareRobustCommand{\chiup}{{\mathpalette\irchi\relax}}
\newcommand{\irchi}[2]{\raisebox{\depth}{$#1\chi$}}

\begin{document}

\newsavebox{\mycases}% Store the equal sign and the case brace
\sbox{\mycases}{$\displaystyle {}=\left\{\begin{array}{@{}l@{}}\mathstrut\\\mathstrut\end{array}\right.\kern-\nulldelimiterspace$}
\begin{align}
\raisebox{-.5\ht\mycases}[0pt][0pt]{$\Delta{X_{lm}}$}
& \raisebox{-.5\ht\mycases}[0pt][0pt]{\usebox{\mycases}}
[ \, \Xi \quad \Theta \, ], \quad \chiup > 0 \label{positive} \\
& \hspace{\wd\mycases}
[ \, \Theta \quad \Xi \, ], \quad \chiup < 0 \label{negative} \\
\shortintertext{where}
\Xi & = \frac{\chiup}{X_{th,kp}} \label{eq:eq:del_Xlm_bnd_Xi} \\
\Theta & = \frac{\chiup}{X_{th,kp} - X_{b}} \label{eq:eq:del_Xlm_bnd_Theta}
\end{align}

\end{document}


• amsfonts is not need if amssymb is already loaded.
• The IEEEtran class tries to use newtxmath (or other Times math fonts) by default, so you shouldn’t load amssymb anyway, if Times-like fonts are used.
• Do not nest aligned within split within align. You can just use cases to write your cases (this is, of course, unrelated to your question).
• Do not manually insert vertical space as in \intertext{where\vspace{0.3\baselineskip}}. Consider using \shortintertext from the mathtools package.
• What’s the purpose of \chiup??? It seems like you somewhat “dislike” how the symbol χ sits on its natural baseline. Please don’t do this! Typographically speaking, shifting it up is simply wrong!
• This is relatively complex for me, but thanks anyway. – Al-Motasem Aldaoudeyeh Jul 22 '18 at 8:11
• @Al-MotasemAldaoudeyeh You’re welcome! Well, complex solution is needed for your complex requests. As I explained, none of the previous answers were suitable for your particular question. This solution is box manipulation essentially: 1) Put =\left\{ inside a box. 2) Add {} and \mathstrut wherever necessary to get the correct spacing. 3) Print the box on the first line of align, but shifted down. This last step is like what you did with \chiup (Please, don’t do this. Just use \chi). – Ruixi Zhang Jul 22 '18 at 14:43

I can propose this, using the numcases and fleqn environments, from the cases and nccmath respectively – and some trial and error:

\documentclass[]{IEEEtran}

\usepackage{amsmath, amssymb}
\usepackage{cases, nccmath}
\DeclareRobustCommand{\chiup}{{\mathpalette\irchi\relax}}

\newcommand{\irchi}[2]{\raisebox{\depth}{$#1\chi$}}

\begin{document}

\begin{numcases}{ \Delta X_{lm} = }
\left[ \thinspace \Xi \quad \Theta \thinspace \right], &$\chiup > 0$
\label{eq:del_Xlm_bnd}
\\
\left[ \thinspace \Theta \quad \Xi \thinspace \right], &$\chiup < 0$
\end{numcases}
\vspace{-1ex}
\begin{fleqn}[4.17em]
\begin{align}
\Xi &= \frac{\chiup}{X_{th,kp}} & & & &
\label{eq:eq:del_Xlm_bnd_Xi}
\\
\Theta &= \frac{\chiup}{X_{th,kp} - X_{b}}
\label{eq:eq:del_Xlm_bnd_Theta}
\end{align}
\end{fleqn}

\end{document}


I am not sur I totally understood the OP's demand, but you can achieve the numbering and the alignment using empheq and align. YOu can also achieve 1.a and 1.b numbering with subequations

[![\documentclass{IEEEtran}

\usepackage{mathtools}
\usepackage{empheq}
\DeclareRobustCommand{\chiup}{{\mathpalette\irchi\relax}}
\newcommand{\irchi}$2${\raisebox{\depth}{$#1\chi$}}

\begin{document}

\begin{empheq}$left={\Delta{X_{lm}}=\empheqlbrace}${align}
\left$\thinspace \Xi \quad \Theta \thinspace \right$, &\chiup > 0 \\
\left$\thinspace \Theta \quad \Xi \thinspace \right$, &\chiup < 0 \label{eq:del_Xlm_bnd}
\end{empheq}
or
\begin{subequations}
\begin{empheq}$left={\Delta{X_{lm}}=\empheqlbrace}${align}
\left$\thinspace \Xi \quad \Theta \thinspace \right$, &\chiup > 0 \\
\left$\thinspace \Theta \quad \Xi \thinspace \right$, &\chiup < 0 \label{eq:del_Xlm_bnd}
\end{empheq}
\end{subequations}
where
\begin{align}
\Xi &= \frac{\chiup}{X_{th,kp}} \label{eq:eq:del_Xlm_bnd_Xi}\\
\Theta &= \frac{\chiup}{X_{th,kp} - X_{b}} \label{eq:eq:del_Xlm_bnd_Theta}
\end{align}

\end{document}