piecewise function

So this is a piecewise defined function I have that I need to talk about:

   f(a,b) = \left\{
\begin{array}{lr}
\text{open} & : \text{RMSD}_\text{s-open}\ge6, \text{RMSD}_\text{closed}\ge6\\
\text{closed} & : \text{RMSD}_\text{closed}\le2 \\
\text{semiopen} & : \text{RMSD}_\text{s-open}\le2\\
\text{transition} & :f(a,b)\notin\{\text{open}, \text{closed}, \text{semiopen}\} \
\end{array}
\right.


So what's the way to align up the colons (conditions) so that it looks all nice and pretty?

Also, if I want to describe transition to be the value of the function when none of the conditions of the previous 3 are satisfied, is the way I wrote it out with f(a,b) not belonging to the set {open,closed,semiopen} a good way of writing it? seems really unprofessional...

-
Welcome to TeX.SE. Just changing the lr to a l@{}l, should give you what you desire. The @{} removes the inter-column spacing. However, you should consider the cases environment. –  Peter Grill Sep 25 '12 at 23:34

You can use the cases environment from amsmath:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$f(a,b) = \begin{cases} \text{open,} &\quad\text{if RMSD}_\text{s-open}\ge6, \text{RMSD}_\text{closed}\ge6\\ \text{closed,} &\quad\text{if RMSD}_\text{closed}\le2 \\ \text{semiopen,} &\quad\text{if RMSD}_\text{s-open}\le2\\ \text{transition,} &\quad\text{otherwise.} \ \end{cases}$

\end{document}


Regarding the other issue, it is usual to write "otherwise".

-

If instead of use lr for the column alignment you use l@{}l, you get the desired result:

Notes:

• The @{} removes the inter column spacing.
• As per barbara beeton's suggestion I added a \thinspace before the colon by a adding a @{\thinspace} between the two columns.

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$f(a,b) = \left\{ \begin{array}{@{}l@{\thinspace}l} \text{open} &: \text{RMSD}_\text{s-open}\ge6, \text{RMSD}_\text{closed}\ge6\\ \text{closed} &: \text{RMSD}_\text{closed}\le2 \\ \text{semiopen} &: \text{RMSD}_\text{s-open}\le2\\ \text{transition} &: f(a,b)\notin\{\text{open}, \text{closed}, \text{semiopen}\} \ \end{array} \right.$
\end{document}

-
i think this would look better with a thin space between "transition" and the colon. –  barbara beeton Sep 26 '12 at 12:39
@barbarabeeton: Good point. Have incorporated your suggestion. –  Peter Grill Sep 26 '12 at 16:32