Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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??

share|improve this question
    
Welcome to TeX.SE. –  Peter Grill Oct 7 '12 at 2:43
add comment

1 Answer

You cannot place a \label as the first element in a cell. If you're interested in labelling the table, place the tabular in a table environment, add a \caption and place the \label after it:

enter image description here

\documentclass{article}
\begin{document}
\begin{table}
  \centering
  \begin{tabular}{c|c|c|c|c|}
    \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}
  \caption{Here is a caption}\label{tlc}
\end{table}
\end{document}

Here is a booktabs alternative to your tabular:

enter image description here

\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\begin{document}
\begin{table}
  \centering
  \begin{tabular}{r*{4}{c}}
    \toprule
    & \multicolumn{2}{c}{1 Sec Trials} & \multicolumn{2}{c}{100 Sec Trials} \\
    \cmidrule(lr){2-3} \cmidrule(lr){4-5}
    Target Rate & Mean & Std. Dev & Mean & Std. Dev \\
    \midrule
    1Hz & 1.07 & 1.08 & 1.22 & 0.11 \\
    5Hz & 4.71 & 2.09 & 4.51 & 0.21 \\
    10Hz & 10.3 & 3.28  & 10.1 & 0.32 \\
    100Hz & 93.6 & 9.91 & 94.6 & 0.97 \\
    \bottomrule
  \end{tabular}
  \caption{Here is a caption}\label{tlc}
\end{table}
\end{document}
share|improve this answer
    
+1 for booktabs beautification –  jja Aug 23 '13 at 11:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.