0

I have a multiline equation as below:

\begin{equation}
l_{t i}\left(v_{t} j\right)=\left\{\begin{array}{ll} \\\
0 & \text { if } r_{j}=r_{i} \\\
1 & \text { if } r_{j}<r_{i} \\\
2 & \text { if } r_{j}>r_{i}
\end{equation}

but I get this error:

! You can't use `\eqno' in math mode.
\endmathdisplay@a ...\df@tag \@empty \else \veqno 
                                                  \alt@tag \df@tag \fi \ifx ...
l.264 \end{equation}

and when I move the line breaks, I get this instead:

! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate 

l.262 1 &
          \text { if } r_{j}<r_{i}
? 

I am not sure what is wrong.

  • 2
    Do you have blank lines in your real equation? – Bernard May 10 at 21:50
  • oh wow thank, I didn't know the blank lines would affect the tag. However, I have another error now (will edit my original question) – dusa May 10 at 21:52
  • 3
    A blank line starts a new paragraph, and it is incompatible with math mode. – Bernard May 10 at 21:55
1

Simply use the cases environment, like this, without any blank line:

\begin{equation}
l_{t i} (v_{t} j)=\begin{cases}  
0 & \text { if } r_{j}=r_{i} \\ 1 & \text { if } r_{j}r_{i}
\end{cases}
\end{equation}
| improve this answer | |

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.