I want to put the equation number at the right for the following code:

 \log{y_{i}} = 
  \begin{array}{l l}
    y_{2i}^{*} & \quad \textrm{if $y_{2i}^{*}\succ0$}\\
    0 & \quad \textrm{otherwise}

Any idea?

  • 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

Do wisely use {} to maintain readability.

\abovedisplayskip=0pt\relax% don't use this line in your production
\log y_i= 
    y_{2i}^* & \quad \text{if $y_{2i}^*\succ0$}\\
    0 & \quad \text{otherwise} 

enter image description here

  • 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. – kiss my armpit Oct 25 '13 at 18:58
  • @Metrics: Please read align versus equation. – kiss my armpit Oct 25 '13 at 19:06
  • 1
    flalign should not be used in this case. – kiss my armpit Oct 25 '13 at 20:35

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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