LaTeX Tip of the Day – cases
If you want to define a piecewise equation in your typeset math, or if you want to express a conditional statement, or just group a set of related equations in math mode, then you’re looking for the cases environment. It’s the way to get that big curly brace on the left of a couple of lines of math. In math mode, the code
f(x,y)=\begin{cases}
0 &\text{for~}x\leq 0\,,\\
\sin x+\phi &\text{for~}x > 0\,.
\end{cases}
will produce the output:
$$f(x,y)=\begin{cases}0 &\text{for }x\leq 0\,,\\ \sin x+\phi &\text{for }x > 0\,. \end{cases}$$
Note that you use an alignment character (&) on each line, and the first character after it on each line will align vertically (it’s as if you’re making a 2-column table). Each line ends with \\ save the last one.
This entire construct only gets one equation number (if you have equation numbering on), and you can’t specify the alignment of the first part of each line. Both of these problems are solved by the cases package.