12

This question already has an answer here:

Consider the following MWE.

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

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

produces an output as follows.

enter image description here

What I want to achieve is as follows.

enter image description here

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{equation}
\begin{cases}
ax + by =c \tag{OK}\\
px + qy = r \tag{Yes}
\end{cases}
\end{equation}
\end{document}

marked as duplicate by egreg amsmath May 30 '15 at 12:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    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. – alandella Sep 9 '13 at 12:40
  • 2
    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
15

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
7

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}{%
 \addtolength{\arraycolsep}{-3.5pt}
 \renewcommand{\arraystretch}{1.1}%
}
  • 1
    That will not place the quation numbers at the right edge of the text block. The resorting to this sort of thing, one should really go and ask for help ;-) – daleif Sep 9 '13 at 13:09
  • 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 :-) – alandella Sep 9 '13 at 13:17
  • It will not, at least then the math will not be in the center. – daleif Sep 9 '13 at 13:38
  • You're right, complied and verified, but still it's my first answer so I'll learn with time :-). – alandella Sep 9 '13 at 14:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.