How to number each equation of simultaneous equations grouped by a left curly brace? [duplicate]

Consider the following MWE.

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{amsmath}

\begin{document}
\abovedisplayskip=0pt\relax
$$\begin{cases} ax + by =c \\ px + qy = r \end{cases}$$
\end{document}


produces an output as follows.

What I want to achieve is as follows.

Is there any idea?

My attempt is as follows, but it does not compile.

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{amsmath}

\begin{document}
\abovedisplayskip=0pt\relax
$$\begin{cases} ax + by =c \tag{OK}\\ px + qy = r \tag{Yes} \end{cases}$$
\end{document}

• I'll have to refer to the MathMode document , and at page 104 there is exactly what are you looking for. Basically it is the addition of \refstepcounter{equation}(\theequation) after every line inside a fake cases environment. – TheVal Sep 9 '13 at 12:40
• Please don't use left brace that points to nothing for grouping. It's redundant. Use matrix form if you want to combine \begin{pmatrix}a&b\\p&q\end{pmatrix}\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}c\\r\end{pmatrix} etc. – percusse Sep 9 '13 at 12:43

See the empheq package.

\documentclass[a4paper]{memoir}
\usepackage{empheq} % autoloads mathtols and amsmath
\begin{document}
\begin{empheq}[left=\empheqlbrace]{align}
ax + by =c \\
px + qy = r
\end{empheq}
\end{document}

• Hello @daleif, I tried your code, but some equations are not aligned: \begin{empheq}[left=\empheqlbrace]{align} \frac{dQ(t)}{dt} = R_a(t) - R_d(t)\\ \frac{dQ(t)}{dt} = 0\\ \frac{dq(t)}{dt} = ir(t) - r_d(t) \\ q(0)=0 \end{empheq} – Gennaro Arguzzi Dec 1 '17 at 10:32
• @GennaroArguzzi then add some &'s where you wanted alignments. The Op did not include alignments in the question – daleif Dec 1 '17 at 11:21

There is the main MWE of a simple example involving multimple cases:

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{amsmath}
%
\begin{document}
\abovedisplayskip=0pt\relax
$\left\{ \begin{array}{cc} ax + by =c & \refstepcounter{equation}(\theequation)\\ ax + by =c & \refstepcounter{equation}(\theequation) \end{array} \right.$
%
\end{document}


If you want to change the spacing of the delimiter before the equations, add this lines to the preamble of the MWE:

\usepackage{etoolbox}
\AtBeginEnvironment{array}{%

• Yes, maybe it will do something adding \hfill to the single argument but I think that your answer is way more elegant and simple than mine :-) – TheVal Sep 9 '13 at 13:17
• You're right, complied and verified, but still it's my first answer so I'll learn with time :-). – TheVal Sep 9 '13 at 14:10