2

I have a system of equations, and I want to use an enumerated cases option -- hence I have been using empheq. But I want the cases part to use subequations. Let me give a MWE which should hopefully clarify things.

\documentclass[]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
    a &= b \label{eq:1} \\
    &=
\begin{cases}
    c_1 %\label{eq:2a}
\\  c_2 %\label{eq:2b}
\end{cases}
\end{align}
\end{document}

Naturally, in order to make this compile, I had to comment out \label{eq:2a} and \label{eq:2b}. I have included these, because I want these two to be labelled 2a and 2b, respectively.

If I didn't have the first line break, ie went straight to a = \begin{cases} ... then I would know how to use this using empheq. However, empheq seems to only work outside of a math environment. I hoped for a version of alignED or gatherED -- but I cannot find one.

Any assistance here would be greatly appreciated. Cheers

Sam OT
  • 1,329
  • Does this help? You can get the 2a, 2b numbering with the subequations environment. – Davislor May 11 '20 at 13:31
  • @Davislor Thanks for the suggestion. I did actually mention subequations in the OP. None of the linked ones seem to do what I am saying...? The accepted answer is closest, but still a bit off -- it is also unbelievably complicated; I just want something like "empheqed". As simple as requrest as it is, maybe it doesn't exist... – Sam OT May 11 '20 at 13:39
  • So you did! The question gets a lot easier if you don’t need to nest it within another align environment. – Davislor May 11 '20 at 15:17
  • Yeah. I can do it without the nesting, but the nesting is causing me issues! :( – Sam OT May 11 '20 at 15:47
  • Can you measure the width of either the LHS of equation 1, and indent the cases by that amount, or the RHS of equation 2 and set it inside a box? – Davislor May 11 '20 at 16:32
  • I guess I can use a "width of" type measuring. That might have to be what I do. I tried numcases and subnumcases too, but they have similar issues that they can't be embedded inside an align environment – Sam OT May 11 '20 at 18:02
  • Turned out to be simpler than that. Thank you. I learned something new from this. – Davislor May 11 '20 at 18:04
  • I'm glad that I could be of such benefit to you ;-) – Sam OT May 11 '20 at 18:15

1 Answers1

2

Good question! Figuring this out took me down several rabbit holes, but it turns out there is a simpler answer than this.

Buried in a footnote to the amsmath manual, we find this tidbit:

The structures align, alignat, etc., are designed for top-level use and for the most part cannot be nested inside some other displayed equation structure. The chief exception is that align and most of its variants can be used inside the gather environment.

Although gather doesn’t align its contents, there is an option to amsmath to make it align to the left. Then, we can introduce a horizontal phantom to align the second equation with the first. We can now use \tag within the inner align and place a scaling brace to its left to make them cases.

\documentclass[]{article}
\usepackage[fleqn]{mathtools}

\begin{document}
\begin{minipage}{5cm} % Solely to smash the image for this MWE.
\begin{gather}
  a            = b \\
  \hphantom{a} = \notag \left\{
        \begin{alignat}{1}
           &c1 \tag{2a} \\
           &c2 \tag{2b}
        \end{alignat}
      \right.
\end{gather}
\end{minipage}
\end{document}

sample image

I’ll leave complications such as incrementing the equation counters correctly and aligning equations with expressions of different widths on their left-hand sides as exercises for the reader.

Another option would be to introduce the sub-equation labels as \text. It’s not the most elegant solution, but it involves a lot less banging heads against the design of amsmath.

Davislor
  • 44,045