# Nested numbered alignement

(disclaimer : yes I have already read : Nested cases, alignment and numbering, no it doesn't help)

I am trying to get something like this :

and :

BUT with the numbering aligned.

I got the above examples by writing :

\begin{align*}
&\mathbf{\dot{x}_s} = \begin{bmatrix}
\mathbf{\ddot{\theta}} & \mathbf{\dot{\theta}} & \mathbf{\ddot{p}} & \mathbf{\dot{p}}
\end{bmatrix}^T = \mathbf{0} \\
\Rightarrow &\begin{cases}
\mathbf{\dot{\theta}} = \mathbf{0} \textrm{\hspace{120pt}(1)}\\
\mathbf{\dot{p}} = \mathbf{0} \textrm{\hspace{120pt}(2)}\\
\mathbf{\ddot{\theta}} = \mathbf{0} \textrm{\hspace{120pt}(3)}\\
\mathbf{\ddot{p}} = \mathbf{0} \textrm{\hspace{120pt}(4)}\\
\end{cases}
\end{align*}


and

\begin{align*}
&\mathbf{\ddot{\theta}} = \mathbf{0} \\
\Rightarrow &\mathbf{\mathcal{I}}^{-1} \cdot \left(-\mathbf{\dot{\theta}} \times \mathbf{\mathcal{I}} \mathbf{\dot{\theta}} + \begin{bmatrix}
M_{\alpha} \\ M_{\beta} \\ M_{\gamma}
\end{bmatrix}\right) = \mathbf{0} \\
\Rightarrow &\begin{cases}
\mathbf{\dot{\theta}} = \mathbf{0} \textrm{\hspace{140pt}(1)}\\
\begin{bmatrix}
M_{\alpha} & M_{\beta} & M_{\gamma}
\end{bmatrix}^T = \mathbf{0}
\end{cases} \textrm{(5)}\\
\end{align*}


For the first I tried :

\begin{align}
&\mathbf{\dot{x}_s} = \begin{bmatrix}
\mathbf{\ddot{\theta}} & \mathbf{\dot{\theta}} & \mathbf{\ddot{p}} & \mathbf{\dot{p}}
\end{bmatrix}^T = \mathbf{0} \nonumber\\
\Rightarrow &\begin{cases}
\mathbf{\dot{\theta}} = \mathbf{0} \\
\mathbf{\dot{p}} = \mathbf{0} \\
\mathbf{\ddot{\theta}} = \mathbf{0} \\
\mathbf{\ddot{p}} = \mathbf{0} \\
\end{cases}
\end{align}


Which leads to only one number for the whole cases env (not what I want) :

And :

\begin{empheq}{align*}
&\mathbf{\dot{x}_s} = \begin{bmatrix}
\mathbf{\ddot{\theta}} & \mathbf{\dot{\theta}} & \mathbf{\ddot{p}} & \mathbf{\dot{p}}
\end{bmatrix}^T = \mathbf{0} \\
\Rightarrow &\begin{empheq}[left=\empheqlbrace]{align}
\mathbf{\dot{\theta}} &= \mathbf{0}\\
\mathbf{\dot{p}} &= \mathbf{0} \\
\mathbf{\ddot{\theta}} &= \mathbf{0} \\
\mathbf{\ddot{p}} &= \mathbf{0}
\end{empheq}
\end{empheq}


Which does not compile.

For the second, I didn't even try to make it better (I coudln't for the first, so neither for the second).

MINIMAL EXAMPLE :

preambule :

\documentclass[
10pt,
english,
twoside
]{article}

\usepackage{mathtools}

\setcounter{MaxMatrixCols}{20}

\usepackage{empheq}


main :

\input{preambule}
\begin{document}

\begin{align}
&\mathbf{\dot{x}_s} = \begin{bmatrix}
\mathbf{\ddot{\theta}} & \mathbf{\dot{\theta}} & \mathbf{\ddot{p}} & \mathbf{\dot{p}}
\end{bmatrix}^T = \mathbf{0} \nonumber\\
\Rightarrow &\begin{cases}
\mathbf{\dot{\theta}} = \mathbf{0} \\
\mathbf{\dot{p}} = \mathbf{0} \\
\mathbf{\ddot{\theta}} = \mathbf{0} \\
\mathbf{\ddot{p}} = \mathbf{0} \\
\end{cases}
\end{align}

\begin{align*}
&\mathbf{\dot{x}_s} = \begin{bmatrix}
\mathbf{\ddot{\theta}} & \mathbf{\dot{\theta}} & \mathbf{\ddot{p}} & \mathbf{\dot{p}}
\end{bmatrix}^T = \mathbf{0} \\
\Rightarrow &\begin{cases}
\mathbf{\dot{\theta}} = \mathbf{0} \textrm{\hspace{120pt}(1)}\\
\mathbf{\dot{p}} = \mathbf{0} \textrm{\hspace{120pt}(2)}\\
\mathbf{\ddot{\theta}} = \mathbf{0} \textrm{\hspace{120pt}(3)}\\
\mathbf{\ddot{p}} = \mathbf{0} \textrm{\hspace{120pt}(4)}\\
\end{cases}
\end{align*}

%\begin{empheq}{align*}
%           &\mathbf{\dot{x}_s} = \begin{bmatrix}
%           \mathbf{\ddot{\theta}} & \mathbf{\dot{\theta}} & \mathbf{\ddot{p}} & \mathbf{\dot{p}}
%           \end{bmatrix}^T = \mathbf{0} \\
%\Rightarrow &\begin{empheq}[left=\empheqlbrace]{align}
%           \mathbf{\dot{\theta}} &= \mathbf{0}\\
%           \mathbf{\dot{p}} &= \mathbf{0} \\
%           \mathbf{\ddot{\theta}} &= \mathbf{0} \\
%           \mathbf{\ddot{p}} &= \mathbf{0}
%           \end{empheq}
%\end{empheq}

\begin{align*}
&\mathbf{\ddot{\theta}} = \mathbf{0} \\
\Rightarrow &\mathbf{\mathcal{I}}^{-1} \cdot \left(-\mathbf{\dot{\theta}} \times \mathbf{\mathcal{I}} \mathbf{\dot{\theta}} + \begin{bmatrix}
M_{\alpha} \\ M_{\beta} \\ M_{\gamma}
\end{bmatrix}\right) = \mathbf{0} \\
\Rightarrow &\begin{cases}
\mathbf{\dot{\theta}} = \mathbf{0} \textrm{\hspace{140pt}(1)}\\
\begin{bmatrix}
M_{\alpha} & M_{\beta} & M_{\gamma}
\end{bmatrix}^T = \mathbf{0}
\end{cases} \textrm{(5)}\\
\end{align*}

\end{document}


Since your screen shot of the desired result does not have the equal signs of the first relation aligned with the other equal signs, you could do something like

\documentclass[10pt,english,twoside]{article}

\usepackage{mathtools}

\setcounter{MaxMatrixCols}{20}

\usepackage{empheq}
\begin{document}
$\hspace{10em}\mathbf{\dot{x}_s} = \begin{bmatrix} \mathbf{\ddot{\theta}} & \mathbf{\dot{\theta}} & \mathbf{\ddot{p}} & \mathbf{\dot{p}} \end{bmatrix}^T = \mathbf{0}$
\vspace*{-\belowdisplayskip}
\begin{empheq}[left=\Rightarrow\empheqlbrace]{align}
\mathbf{\dot{\theta}} &= \mathbf{0}\\
\mathbf{\dot{p}} &= \mathbf{0} \\
\mathbf{\ddot{\theta}} &= \mathbf{0} \\
\mathbf{\ddot{p}} &= \mathbf{0}
\end{empheq}

\begin{align*}
\mathbf{\ddot{\theta}} &= \mathbf{0} \\
\Rightarrow \mathbf{\mathcal{I}}^{-1} \cdot \left(-\mathbf{\dot{\theta}} \times \mathbf{\mathcal{I}} \mathbf{\dot{\theta}} + \begin{bmatrix}
M_{\alpha} \\ M_{\beta} \\ M_{\gamma}
\end{bmatrix}\right) &= \mathbf{0} \hspace{3em}
\end{align*}
\begin{empheq}[left=\Rightarrow\empheqlbrace]{align}
\mathbf{\dot{\theta}} &= \mathbf{0} \\
\begin{bmatrix}
M_{\alpha} & M_{\beta} & M_{\gamma}
\end{bmatrix}^T &= \mathbf{0}
\end{empheq}
\end{document}


• This solution works to answer the question as I have worded initially, but I realize it doesn't solve my problem. I have rephrased my question in order to reflect that. Sorry for the inconvenience. Jan 11, 2020 at 17:31
• @JambonSama If I am not mistaken, the second one works the same way, please see my update.
– user194703
Jan 11, 2020 at 18:07
• Right, it indeed does. I tried to adapt your first answer to make it work, but I couldn't, that's why i commented so. Thank you very much ! I've taken your answer for my report. I'll still wait a little to see if anyone comes up with something with automatic alignment, instead of manual hspace, but thanks :) Jan 11, 2020 at 20:56
• @JambonSama Just for the records: I did use the \hspace because I was/am under the impression that perfect alignment is not a requirement. If it is, there are alternative solutions, which are, however, more involved. It would be great if you could spell out the precise requirements,
– user194703
Jan 11, 2020 at 21:28