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 want to put the equation number at the right for the following code:

\[
 \log{y_{i}} = 
\left\{
  \begin{array}{l l}
    y_{2i}^{*} & \quad \textrm{if $y_{2i}^{*}\succ0$}\\
    0 & \quad \textrm{otherwise}
  \end{array} 
    \right.
    \]

Any idea?

share|improve this question
    
Do you want the individual elements in the array numbered, or the equation as a whole? –  Werner Oct 25 '13 at 18:43
    
I want the equation as a whole. –  Metrics Oct 25 '13 at 18:44
add comment

2 Answers

up vote 16 down vote accepted

Do wisely use {} to maintain readability.

\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}
\begin{document}
\abovedisplayskip=0pt\relax% don't use this line in your production
\begin{equation}
\log y_i= 
\begin{cases}
    y_{2i}^* & \quad \text{if $y_{2i}^*\succ0$}\\
    0 & \quad \text{otherwise} 
\end{cases}
\end{equation}
\end{document}

enter image description here

share|improve this answer
    
Thanks for the alternative solution –  Metrics Oct 25 '13 at 18:55
4  
@Metrics: It is not the alternative solution but the correct one. align is used when you have more than one equation to be aligned. –  I am who I say I am Oct 25 '13 at 18:58
    
@Metrics: Please read align versus equation. –  I am who I say I am Oct 25 '13 at 19:06
1  
Thank you for the link @Marienplatz –  Metrics Oct 25 '13 at 19:14
1  
flalign should not be used in this case. –  I am who I say I am Oct 25 '13 at 20:35
add comment

load package amsmath and then replace \[ ... \] by

\begin{flalign}
...
\end{flalign}
share|improve this answer
    
Thanks. It worked. –  Metrics Oct 25 '13 at 18:49
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.