GeneralI get "missing $ inserted" but don't know why

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Jacare
Posts: 2
Joined: Mon Apr 11, 2011 6:36 am

I get "missing $ inserted" but don't know why

Post by Jacare »

Hi,

I use TeXlive in Ubuntu.

I've been compiling a tex file, with the following table.

-------------------------------------------------------------------------------------------------------------------------
...............................................
\begin{table}
\caption{Results of fits for LiF \label{tab:LiFresults}}
\begin{tabular}{| c | c | c | c |}
\hline
Peak & n & Characteristic line & $2 \theta$ \\
\hline
1 & 1 & $K_{\beta}$ & 40.371 \pm 0.026^{\circ} \\
\hline
2 & 1 & $K_{\alpha}$ & 44.879 \pm 0.005^{\circ} \\
\hline
3 & 2 & $K_{\beta}$ & 87.148 \pm 0.308^{\circ} \\
\hline
4 & 2 & $K_{\alpha}$ & 99.510 \pm 0.055^{\circ} \\
\hline
\end{tabular}
\end{table}
..................................etc.etc.
------------------------------------------------------------------------------------------------------------

The compiling works. But I get warnings. Here is an excerpt from the output.

------------------------------------------------------------------------------------------------------------
...............
! Missing $ inserted.
<inserted text>
$
l.206 1 & 1 & $K_{\beta}$ & 40.371 \pm
0.026^{\circ} \\
? ! Extra }, or forgotten $.
<template> \unskip \hfil }
\hskip \tabmidsep \relax \hskip -.5\arrayrulewidth...
l.207 \hline

? ! Missing $ inserted.
<inserted text>
$
l.207 \hline

? ! Missing } inserted.
<inserted text>
}
l.207 \hline

? ! Missing $ inserted.
<inserted text>
$
l.208 2 & 1 & $K_{\alpha}$ & 44.879 \pm
0.005^{\circ} \\
...............etc. etc.
-----------------------------------------------------------------------------------------------

I get a list of such warning from this and another table. Although the compiling works, the warning are cluttering my output, and I'm afraid that I won't be able to spot an important warning or an error because I don't have the time to check it carefully every time it compiles.

What did I do wrong?

Or is it something wrong with the compiler?

Thanks
Last edited by Jacare on Tue Apr 12, 2011 12:45 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

I get "missing $ inserted" but don't know why

Post by localghost »

Jacare wrote:[…] The compiling works. But I get warnings. Here is an excerpt from the output. […]
Please always provide a full but minimal example [1]. Otherwise specific help is nearly impossible especially when a problem becomes more complicated.

Compilation is far from being flawlessly. And you get no warnings but solid error messages. The commands \pm and ^ (for superscript) only work in math mode.

[1] View topic: Avoidable mistakes


Best regards and welcome to the board
Thorsten
Jacare
Posts: 2
Joined: Mon Apr 11, 2011 6:36 am

I get "missing $ inserted" but don't know why

Post by Jacare »

localghost wrote:Source code has to be tagged as such by using the »Code« environment of the foum software
localghost wrote:Please always provide a full but minimal example [1].
Sorry. My fault. Won't happen again.
localghost wrote:The commands \pm and ^ (for subscript) only work in math mode.
Yes! That solved it! Thanks!
Post Reply