# How to align if-condition in equation systems

I use this environment for an equation system:

\newenvironment{sistema}{\left\lbrace\begin{array}{@{}l@{}}}{\end{array}\right.}


But in this way the "if-conditions" are not aligned, as an example:

$\lvert a \rvert = \begin{sistema} a \quad \text{if } a > 0 \\ -a \quad \text{otherwise} \end{sistema}$


Is it possible to align them? (Or even simpler) is there any other enviroment that build sytems automatically?

-

\usepackage{amsmath}

...

$\lvert a \rvert = \begin{cases} a & \text{if a>0,} \\ -a & \text{otherwise} \end{cases}$


You probably found the sistema environment on the GuIT forum, but that's for single equations. The more general cases environment is just for this kind of applications.

Notice that putting a formula inside \text avoids cumbersome uses of spaces.

-
Yes, more precisely I've found it in the Pantieri's website. Anyway cases is perfect. Grazie. –  Baduel Dec 8 '11 at 17:34

Are you looking for cases?

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\lvert a \rvert = \begin{cases} a & \text{if } a > 0 \\ -a & \text{otherwise} \end{cases}$
\end{document}


Or you could use the more adaptable tabular:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\lvert a \rvert = \left\lbrace \begin{tabular}{rl} a & \text{if } a > 0 \\ -a & \text{otherwise} \end{tabular} \right.$
\end{document}


Note that this environment allows you an arbitrary number of "columns" separated by & symbols and you can specify how each is to be aligned. In this case the first is right aligned so the "a"s match up, the second left aligned so the case conditions line up.

-
Yes, cases is what I'm looking for. Thanks. –  Baduel Dec 8 '11 at 17:36