missing $ inserted

nina picture nina · Mar 5, 2011 · Viewed 14.1k times · Source

Hi I have trubles with compiling this

    \begin{equation}
J = \sum_{j=1}^{C}
\end{equation}

I constantly gets an error

missing $ inserted

which is quite strange because I'm pretty sure that I'm in math environment I alsow tried this

\begin{equation}
J = $\sum_{j=1}^{C}$
\end{equation}

or this

\begin{equation}
J = $\sum_{$j=1$}^{$C$}$
\end{equation}

but it didnt't do the trick

EDIT The only thing above is

 \begin{equation}
 d_{ij}^2 = || x_{i} - p_{ij}||^2 = || x_{i} - (R_{j}s_{j}p_{ij}^* + t_{j}  ) ||^2

\end{equation}

However if I delete this the document compile. It seems that in this section there is some error

Answer

Thomas picture Thomas · Mar 5, 2011

You have a double newline (i.e. a blank line) in the second code snippet. This causes TeX to drop out of math mode in an attempt to correct this error, hence the subsequent errors about missing $s.