The code below describes a table that goes like:
|_|x x|x x|
|x|x|x|x|x|
|x|x|x|x|x|
where
|_|
= empty cell, |x x|
= multicolumn{2}
, |x|
= cell with text in it.
\begin{tabular}{c|c|c|c|c|}
\label{tlc}
\cline{2-5}
& \multicolumn{2}{|c}{1 Sec Trials} & \multicolumn{2}{|c|}{100 Sec Trials} \\
\hline
\multicolumn{1}{|c|}{Target Rate} & Mean & Std. Dev & Mean & Std. Dev \\
\hline
\multicolumn{1}{|r|}{1Hz} & 1.07 & 1.08 & 1.22 & 0.11 \\
\multicolumn{1}{|r|}{5Hz} & 4.71 & 2.09 & 4.51 & 0.21 \\
\multicolumn{1}{|r|}{10Hz} & 10.3 & 3.28 & 10.1 & 0.32 \\
\multicolumn{1}{|r|}{100Hz} & 93.6 & 9.91 & 94.6 & 0.97 \\
\hline
\end{tabular}
However, when I run it I get an error that reads
! Misplaced \omit.
\@cline #1-#2\@nil ->\omit
\@multicnt #1\advance \@multispan \m@ne \ifnum \@...
l.60 \cline{2-5}
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.
I've Googled around and it seems that people often get errors like this when nesting \multicolumns
inside \multirows
, or when they put text in the cell before starting the \multicolumn
. But that is not the case in my code.
Can anyone tell me what is going on??
Best Answer
You cannot place a
\label
as the first element in a cell. If you're interested in labelling the table, place thetabular
in atable
environment, add a\caption
and place the\label
after it:Here is a
booktabs
alternative to yourtabular
: