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.

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...

share|improve this question
    
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
add comment

2 Answers 2

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}

enter image description here

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

share|improve this answer
add comment

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

enter image description here

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}
share|improve this answer
1  
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
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.