3

I have a compilation error trying to use the math symbols <= <, etc.

the error looks like this:

./chapters/intro.tex:49: Missing $ inserted. [Delta & \delta],
./chapters/intro.tex:49: Missing $ inserted. [Delta & \delta < 4Hz &]
./chapters/intro.tex:50: Missing $ inserted. [Theta &  4Hz < \theta]
./chapters/intro.tex:50: Missing $ inserted. [Theta &  4Hz < \theta \leq 8Hz &]

and this is the code causing it

\begin{tabular}{l l l}
\hline
EEG rhythm & Frequency band & Mental association \\
\hline
Delta & \delta < 4Hz & Sleep \\
Theta &  4Hz < \theta \leq 8Hz & Sleep \\
\hline
\end{tabular}

I know there have been similar question but I read the answers and I could not figure it out for my case.

Thanks!

Mico
  • 506,678
nest
  • 133

3 Answers3

6

There are actually two issues with the way you're typesetting these tables. First, as already noted in @cfr's answer, you must use TeX's math mode for the macros \delta, \theta, and \leq (as well as for getting the proper spacing around the symbol <). Second, you need to apply some care with the way you enter numbers and their scientific units. The most straightforward way I can think of to handle the second issue is to load the siunitx package and to use its \SI macro. Using the \SI macro will insert the right amount of space between the number and the unit and will typeset the units in upright Roman mode rather than in math italic mode.

enter image description here

\documentclass{article}
\usepackage{siunitx}  % for '\SI' macro
\begin{document}
\begin{tabular}{l l l}
\hline
EEG rhythm & Frequency band & Mental association \\
\hline
Delta & $\delta < \SI{4}{Hz}$ & Sleep \\
Theta &  $\SI{4}{Hz} < \theta \leq \SI{8}{Hz}$ & Sleep \\
\hline
\end{tabular}
\end{document}
Mico
  • 506,678
3

\delta, theta and \leq are commands for maths mode. You are trying to use them in text mode (which is the default). You need to switch to maths mode in order for it to work:

Delta & $\delta < 4Hz$ & Sleep \\
Theta &  $4Hz < \theta \leq 8Hz$ & Sleep \\

In each case, the first $ enters maths mode and the second leaves it, returning to text mode.

cfr
  • 198,882
-1

You should write $\leq$, instead of just \leq.

Au101
  • 10,278
Leong
  • 7
  • 2
    Welcome to the site! This is essentially true, although, as noted above, there are other things which need to be in math mode and, more to the point, the entire inequality needs to be in math mode. The inequality is one unit and needs to be treated as such so that you get the correct spacing. Just having $\leq$ and changing nothing else will throw errors because of \delta and co, but putting all of them individually in math mode would be the wrong approach, too. See above. More generally, though, I'm not sure what this adds to the other answers, nearly one year on? – Au101 Nov 29 '15 at 17:30