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.

I'm trying to code column headers in LaTeX so that each header spans two columns; however, the following code isn't working:

\usepackage{booktabs}
\begin{tabular}{cccc}
\toprule
\multicolumn{2}{c}{Assets} & \multicolumn{2}{c}{Liabilities and Equities} \\
\cmidrule(r){1-2} \cmidrule(r){3-4}
Cash & \$13,152 & Short position (200 shares owed) & \$13,152 \\
\bottomrule
\end{tabular}

Assets should span the first two columns, and Liabilities and Equities should span the second pair. When I compile this, I get this error:

Misplaced \omit.
\multispan ->\omit 
                   \@multispan 
l.221 ...lticolumn{2}{c}{Liabilities and Equities}

Thanks!

EDIT: This is now correct! Please see my comment. I can't add an answer for a while because I'm new, but maybe someone else could and I'll up vote it.

share|improve this question
    
I was missing the ampersand between the multicolumn statements. Adding it corrected the problem. –  Ricardo Altamirano Sep 11 '11 at 2:28

2 Answers 2

up vote 2 down vote accepted

Glad you already noticed the missing & between the two \multicolumn statements. One more thing: you may want to change the trimming option on the second \cmidrule statement from (r) to (l), in order to get a bit more of a horizontal separation between the two lines. Happy TeXing!

share|improve this answer
    
Thanks for the tip; that does look a little better. –  Ricardo Altamirano Sep 11 '11 at 13:22

You seem to be missing &:

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{cccc}
\toprule
\multicolumn{2}{c}{Assets} &\multicolumn{2}{c}{Liabilities and Equities} \\
\cmidrule(r){1-2} \cmidrule(r){3-4}
Cash & \$13,152 & Short position (200 shares owed) & \$13,152 \\
\bottomrule
\end{tabular}
\end{document}
share|improve this answer
1  
the & between \cmidrule will cause an error! –  Herbert Sep 11 '11 at 8:19
    
Yes it does; -1 if I could. –  Ricardo Altamirano Sep 11 '11 at 13:21
    
Sorry about that. I have corrected that. It had compiled for me, but then I had commented that line out while trying to determine the problem. When I noticed that line being commented I was able to get it to compile for me, but forgot that I had also removed the &. –  Peter Grill Sep 11 '11 at 15:58

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.