# Using multiple \multicolumn commands in a table to achieve column headers

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.

-
I was missing the ampersand between the multicolumn statements. Adding it corrected the problem. –  Ricardo Altamirano Sep 11 '11 at 2:28

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!

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

-
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