The cases
environment of the amsmath
package provides the simplest way to break out a function into different cases. But one can see in the first example that the alignment of the right portion will be affected by the width of what is on the left. Thus, cases
supports the use of the alignment tab &
to separate and align columns of the case, as shown in the 2nd case.
With the *
version of the environment (example 3), which is provided by the mathtools
package, the right-hand portion of the case is set as text automatically.
With dcases
family of environments, also from the mathtools
package, the math is set in \displaystyle
automatically (example 4).
As you can see from the comments, there are many environments in the cases
family, and one should (myself included) study the documentation to get them all straight.
\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
\[
f(x) =
\begin{cases}
a \quad\text{if } x>0\\
b \quad\text{if } x\le0
\end{cases}
\]
\[
f(x) =
\begin{cases}
a & \text{if } x>0\\
b & \text{if } x\le0
\end{cases}
\]
\[
f(x) =
\begin{cases*}
\frac{a}{b} & if $x>0$\\
b_3 & for all other situations
\end{cases*}
\]
\[
f(x) =
\begin{dcases*}
\frac{a}{b} & if $x>0$\\
b_3 & for all other situations
\end{dcases*}
\]
\end{document}

cases
environment of theamsmath
package.\documentclass{article} \usepackage{amsmath} \begin{document} \[ f(x) = \begin{cases} a\qquad\text{if } x>0\\b\qquad\text{if } x\le0 \end{cases} \] \end{document}
. Additional options are possible ifa
andb
are different widths.