# A set of equations, vertically aligned, individually tagged, with subequations, and separate label

Can the following be achieved using just amsmath and mathtools? (If not, what other tools do I need?)

I have a collection of equations

\begin{align}
A &= B \\
C &= D \\
E &= F
\end{align}


I want the following display:

1. The three equations are all aligned at the = sign (like above)
2. The equation numbers for the first two are "subequations", that is the first equation is numbered (1a), the second (1b), but the third (2). (The numbering should be dynamical, I don't want to hard-code an equation number that I'd have to change every time.)
3. Since I am already putting the equation number on the left, I want to group the first two equations and mark them with a brace. Something similar to what can be done with

\begin{equation*}
\left.\begin{aligned}
A &= B\\
C &= D
\end{aligned}\right\}\text{Some description}
\end{equation*}


I know how to do each of 1, 2, and 3 separately. I am at a loss on how to put any two of them together. I would love to know how to achieve all three at the same time.

Edit: To do 1 and 2 together, I can use one of these answers.

Edit 2: A partial solution toward doing 1 and 3 together is to use the empheq package as described here. However best as I can tell the brace is an "all or nothing" thing. I can't just brace the first two out of three expressions.

-

The following is taken from Mixed (sub)equation numbering within an array (which satisfies 1 & 2), with the addition of grouping via braces (satisfying 3):

\documentclass{article}
\usepackage[leqno]{amsmath}% http://ctan.org/pkg/amsmath
\newcounter{subeqn} \renewcommand{\thesubeqn}{\theequation\alph{subeqn}}%
\makeatletter
\makeatother
\newcommand{\subeqn}{%
\refstepcounter{subeqn}% Step subequation number
\tag{\thesubeqn}% Label equation
}
\begin{document}
\begin{align}
A + B &\to C + D \\
E + F &\to G + H \label{eq:EFGH}
\smash{\raisebox{\dimexpr.5\normalbaselineskip+.5\jot}{$% \left.\begin{array}{@{}c@{}}\\[\jot]\\[\jot]\end{array}\right\}\text{Description 1}$}}\\
I + J &\to K + L \refstepcounter{equation}\subeqn \\
&\to M + N \subeqn \label{eq:MN}
\smash{\left.\begin{array}{@{}c@{}}\\[\jot]\\[\jot]\\[\jot]\end{array}\right\}\text{Description 2}}\\
&\to O + P \subeqn
\end{align}

The EFGH equation is \eqref{eq:EFGH} and the MN is equation~\eqref{eq:MN}.
\end{document}


For grouping an odd number of equations, insert a \smashed array in the middle equation. For an even number of equations, insert a \smashed array in the equation just below the middle, and move it up .5\normalbaselineskip+.5\jot, putting it right in the middle (vertically).

The array has a @{}c@{} column specification, thereby have width zero. However, the \nulldelimiterspace on the left (from \left.) pushes it slightly away from the equations. The vertical line skip of \\[\jot] within each array is to maintain the same vertical height as that of align.

-
Ooh, this looks promising. I'll give it a try tomorrow. Thanks! –  Willie Wong Apr 9 '12 at 15:29
It almost works (except for one minor detail): the line heights of equation/align environments aren't always fixed. For example, if you insert \int in front of A+B in the first line of the align, the vertical size and alignment of the array breaks. :-( –  Willie Wong Apr 10 '12 at 9:02
@WillieWong: You'll notice that my "filler" array for the right brace \} is empty. You could try inserting the same content that is visible inside the align environment, but hide it with \vphantom. –  Werner Apr 10 '12 at 14:05

Check this:

\begin{subequations}
\begin{align}
A &= B \\
C &= D \\
E &= F\tag{2}
\end{align}
\end{subequations}

-
I don't want to hard-code the tag for the third equation (which will require me changing the number every single time the document is changed). –  Willie Wong Apr 5 '12 at 10:54

I tried experimenting with the various environments from the mathtools package (such as cases, rcases, etc), but had no success.

If you combine the answers from

Then you can achieve

which I think (?) is what you want.

\documentclass{article}
\usepackage[leqno]{amsmath}
%%%%%%%%%%%%%%%%%%%%%%%%%%
% taken from
% http://tex.stackexchange.com/questions/34566/mixed-subequation-numbering-within-an-array
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{etoolbox}
\AtBeginEnvironment{align}{\setcounter{subeqn}{0}}% Reset subequation number at start of align
\newcounter{subeqn} \renewcommand{\thesubeqn}{\theequation\alph{subeqn}}%
\newcommand{\subeqn}{%
\refstepcounter{subeqn}% Step subequation number
\tag{\thesubeqn}% Label equation
}
%%%%%%%%%%%%%%%%%%%%%%%%%%
% taken from
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture,baseline] \node[anchor=base] (#1) {\phantom{1}};}

\begin{document}
\begin{align}
A + B &\to C + D \\
E + F &\to G + H \label{eq:EFGH} \\
I + J &\to K + L \hfill\tikzmark{right} \refstepcounter{equation}\subeqn \\
&\to M+N \tikzmark{1st}\subeqn \label{eq:MN}\\
&\to O + P\tikzmark{2nd} \subeqn
\end{align}

\begin{tikzpicture}[overlay, remember picture]
\draw [decoration={brace,amplitude=0.5em},decorate,ultra thick,red]
(1st.north)--(2nd.south);
\end{tikzpicture}

The EFGH equation is \eqref{eq:EFGH} and the MN is equation~\eqref{eq:MN}.
\end{document}

-