我想将方程编号放在以下代码的右边:
\[
\log{y_{i}} =
\left\{
\begin{array}{l l}
y_{2i}^{*} & \quad \textrm{if $y_{2i}^{*}\succ0$}\\
0 & \quad \textrm{otherwise}
\end{array}
\right.
\]
任何想法?
答案1
请明智使用{}
以保持可读性。
\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}
答案2
加载包amsmath
然后替换\[ ... \]
为
\begin{flalign}
...
\end{flalign}