4

I'm trying to write these four piecewise-defined functions.

enter image description here

I wrote this code:

\begin{equation}
 \theta = \begin{cases}
  \theta r + Se \left( \theta s - \theta r \right)  & Hp < 0 \\
  \theta s                                                        & Hp \geq 0
  \end{cases} \\
\end{equation}

\begin{equation}
 Se =  \begin{cases}
  \frac{1}{[1 + |\alpha Hp|^n]^m}  & Hp < 0 \\
  1                                               & Hp \geq 0
  \end{cases} \\
\end{equation}

\begin{equation}
 C_m = \begin{cases}
  \frac{\alpha m}{1 - m} \left( \theta s - \theta r \right) Se^{\frac{1}{m}} [1 - Se^{\frac{1}{m}} ]^m & Hp < 0 \\
  0                                                                                                                                                & Hp \geq 0
  \end{cases} \\
\end{equation}

\begin{equation}
 K_r = \begin{cases}
  Se^ l [1-[1- Se^{\frac{1}{m}}]^m] ^2 & Hp < 0 \\
  1                                                       & Hp \geq 0
  \end{cases}\\
\end{equation}

And I got this result:enter image description here

How is it possible to separate these four piecewise-defined functions?

Pier Paolo
  • 2,790
Sepideh
  • 41

2 Answers2

8

Only use one ampersand, &.

See page 68 in lshort: https://tobi.oetiker.ch/lshort/lshort.pdf

Example:

\begin{equation*}
    |x| = \begin{cases}
              -x & \text{if } x < 0,\\
               0 & \text{if } x = 0,\\
               x & \text{if } x > 0.
          \end{cases}
\end{equation*}

Produces:

enter image description here

Tommy L
  • 181
  • 1
    I tend to prefer cases* which gives you the second cell in text mode so this line would be -x & if $x < 0$,\\. BTW, what font is that? – Manuel Feb 17 '15 at 09:33
  • Yes, the starred version is useful. It's the Arev font: http://www.tug.dk/FontCatalogue/arev/ – Tommy L Feb 17 '15 at 10:31
4

Besides the use of cases as per Tommy L's answer, you could also:

  1. Use an align environment since you have multiple consecutive equations,
  2. Use a \makebox to obtain an alignment of the conditions.

enter image description here

Notes:

  • It is only necessary to apply the \MakeBox macro on one of the cases.
  • I used the mathtools package as that incorporates some fixes on amsmath even though it doesn't make a difference in this particular case.

Code:

\documentclass{article}
\usepackage{mathtools}
\usepackage{calc}

\newcommand{\WidestExpression}{\frac{\alpha m}{1 - m} \left( \theta s - \theta r \right) Se^{\frac{1}{m}} [1 - Se^{\frac{1}{m}} ]^m} \newcommand{\MakeBox}[1]{\makebox[\widthof{$\WidestExpression$}][l]{$#1$}}

\begin{document} \begin{align} \theta &= \begin{cases} \theta r + Se \left( \theta s - \theta r \right) & Hp < 0 \ \MakeBox{\theta s} & Hp \geq 0 \end{cases} \ Se &= \begin{cases} \frac{1}{[1 + |\alpha Hp|^n]^m} & Hp < 0 \ \MakeBox{1} & Hp \geq 0 \end{cases} \ C_m &= \begin{cases} \WidestExpression & Hp < 0 \ 0 & Hp \geq 0 \end{cases} \ K_r &= \begin{cases} Se^ l [1-[1- Se^{\frac{1}{m}}]^m] ^2 & Hp < 0 \ \MakeBox{1} & Hp \geq 0 \end{cases}\ \end{align} \end{document}

Peter Grill
  • 223,288