8

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?

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
Metrics
  • 365

2 Answers2

16

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

Moriambar
  • 11,466
3

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

\begin{flalign}
...
\end{flalign}