0

how can correct the error of missing $ inserted

\begin{equation*}


$ V^{(b)}_{i} $ = 
\begin{cases}

 1, & \text{ if the bus b visits stop i }. \\
 0, & \text {otherwise} 

\end{cases}  
\end{equation*} 
Andrew Swann
  • 95,762
  • Remove the blank lines and the $'s – Andrew Swann Nov 05 '16 at 11:53
  • 1
    you should remove the $ as equation has already started math mode, and remove the blank lines which are not allowed in math mode, not a tex error but bus b visits stop i should be bus $b$ visits stop $i$ – David Carlisle Nov 05 '16 at 11:53

1 Answers1

0

An equation environment should not contain any blank lines. In tex blank lines signal the start of a new paragraph and that is not allowed within in an equation. Furthermore the content of equation is already in math mode, so you do not want to switch out of math mode via $ for symbols such as V^{(b)}_i. In the other hand in the conditions for the cases, you are inside a \text command and need to write $b$ and $i$ it get those symbols in math mode.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
 V^{(b)}_{i}  =
 \begin{cases}
   1, & \text{if the bus $b$ visits stop $i$,} \\
   0, & \text {otherwise.}
 \end{cases}
\end{equation*}

\end{document}

Sample output

If you use mathtools rather than/on top of amsmath then there is the convenient dcases* environment where the \text command is automatically used for the side conditions (and the first part is set as displayed math):

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{equation*}
 V^{(b)}_{i}  =
 \begin{dcases*}
   1, &if the bus $b$ visits stop $i$, \\
   0, &otherwise.
 \end{dcases*}
\end{equation*}

\end{document}
Andrew Swann
  • 95,762