Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted
\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.

share|improve this answer
    
Yes, more precisely I've found it in the Pantieri's website. Anyway cases is perfect. Grazie. –  Baduel Dec 8 '11 at 17:34
add comment

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.

share|improve this answer
    
Yes, cases is what I'm looking for. Thanks. –  Baduel Dec 8 '11 at 17:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.