# Error typesetting large bracket with multiple lines

I was following a Wikibooks section to create multiple lines within a single large bracket. Something like this.

The problem is that when I type in the given code, which is

$u(x) = \begin{cases} \exp{x} & \text{if } x \geq 0 \\ 1 & \text{if } x < 0 \end{cases}$

I get the following error in my document:

Misplaced alignment tab character &.

Any idea what might be going wrong?

• You probably don't have \usepackage{amsmath} Jul 16 '13 at 8:34
• include a MWE and you might get help
– bene
Jul 16 '13 at 8:58
• @egreg: Thanks, it was the missing amsmath package only! But that's not fair; why didn't I get a "not found" error in that case? Jul 16 '13 at 10:30
• @dotslash Unfortunately, the first version of LaTeX copied the \cases macro from Plain TeX and it's still there for backwards compatibility. So LaTeX doesn't balk when finding \begin{cases} because this means doing \cases; but the syntax of the Plain TeX \cases is very different (and foreign to LaTeX), so the weird error messages. Jul 16 '13 at 10:37
• Amazing info! What, then, is the native LaTeX syntax for \cases? Jul 16 '13 at 15:48

The LaTeX kernel provides a \cases command that's literally copied from Plain TeX. This is a remnant from the olden days and it is the reason why

\begin{cases}
...
\end{cases}

The syntax for \cases is really foreign to LaTeX; it must be used in math mode (inline or display) as

\cases{
\exp{x} & if $x \geq 0$ \cr
1       & if $x < 0$    \cr
}

Notice \cr for terminating the row, where \\ wouldn't work; note also that the second column is typeset in text mode, differently from the cases environment of amsmath.

It's surely better to load amsmath (which also provides \text) and input your equation as

\usepackage{amsmath}

...

$u(x) = \begin{cases} \exp{x} & \text{if x \geq 0} \\ 1 & \text{if x < 0} \end{cases}$

I always recommend reentering math mode without closing \text; it's more practical.