[Tex/LaTex] Align multiple equations within right braces

aligncases

I'm trying to make an array of equations where some of them are marked with right braces. For the right braces I have used the rcases command from the solution offered at: https://tex.stackexchange.com/a/47563/131192. I want the equations to be aligned at the equal sign, but I can't manage to do so. Here is an example of what I'm trying to do, but it doesn't give me good results:

\documentclass{article}
\usepackage{amsmath}

\newenvironment{rcases}
  {\left.\begin{aligned}}
  {\end{aligned}\right\rbrace}

\begin{document}

\begin{align*}
&\begin{rcases}
    a &= b + c \\
    d &= e + f + g \\
    h &= i + j + k + l
\end{rcases}
\text{ three equations}\\
&\begin{rcases}
    \implies m &= n \\
    o &= p*q
\end{rcases}
\text{another two equations}
\end{align*}

\end{document}

aligning eqns

Thanks for any help!

Best Answer

This falls into the general category of aligning things in different (aligned) environments. One solution is to use \hphantom to compensate for the differences. The other is to put them all into one environment and try to align the right braces to the corresponding text using (for example) \vphantom.

\documentclass{article}
\usepackage{amsmath}

\newenvironment{rcases}
  {\left.\begin{aligned}}
  {\end{aligned}\right\rbrace}

\begin{document}

This uses \verb$\hphantom$.
\begin{align*}
&\begin{rcases}
    \hphantom{\implies m}\llap{$a$} &= b + c \\
    d &= e + f + g \\
    h &= i + j + k + l
\end{rcases}
\text{ three equations}\\
&\begin{rcases}
    \implies m &= n \\
    o &= p*q
\end{rcases}
\text{another two equations}.
\end{align*}

This uses \verb$\vphantom$
\begin{equation*}
\begin{aligned}
    a &= b + c \\
    d &= e + f + g \\
    h &= i + j + k + l\\
    \implies m &= n \\
    o &= p*q
\end{aligned}
\begin{aligned}
&\left.\vphantom{\begin{aligned}
    a &= b + c \\
    d &= e + f + g \\
    h &= i + j + k + l
  \end{aligned}}\right\rbrace\quad\text{three equations}\\
&\left.\vphantom{\begin{aligned}
    \implies m &= n \\
    o &= p*q
  \end{aligned}}\right\rbrace\quad\text{another two equations}
\end{aligned}
\end{equation*}

\end{document}

demo

Related Question