Math & ScienceNumbered lines in "cases"

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Adampe
Posts: 2
Joined: Sat Dec 29, 2012 7:45 pm

Numbered lines in "cases"

Post by Adampe »

Hello,

I want to have numbered every line in \begin{cases} so I can later refer to it. I have tried sth like this:

Code: Select all

\begin{equation}
A = \begin{cases}
    B \\
    C
\end{cases}
\end{equation}
and this

Code: Select all

\begin{equation}
A = \left\{
\begin{array}{l}
    B \\
    C
\end{array}\right.
\end{equation}
but I have only one number:
Image

How can I write this to have numbered every line?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

elingeniero
Posts: 12
Joined: Mon Feb 13, 2012 12:30 pm

Numbered lines in "cases"

Post by elingeniero »

You can use the cases package, an example of of its usage is given here:

Code: Select all

\documentclass{standalone}
\usepackage{amsmath}
\usepackage{cases}
\begin{document}
\begin{numcases}{f(x)=}
1&$x\geq0$\label{positive}\\
0&$x<0$\label{negative}
\end{numcases}

See the second case \ref{negative} or the first \ref{positive}

\begin{subnumcases}{f(x)=}
1&$x\geq0$\label{positive-subnum}\\
0&$x<0$\label{negative-subnum}
\end{subnumcases}

See the second case \ref{negative-subnum} or the first \ref{positive-subnum}
\end{document}
Adampe
Posts: 2
Joined: Sat Dec 29, 2012 7:45 pm

Re: Numbered lines in "cases"

Post by Adampe »

Thank You very much, it is exactly what I need.
Post Reply