[Tex/LaTex] Use multiple \multicolumn commands in a LaTeX table to achieve column headers

errorstables

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}

Best Answer

It seems you are doing this correct, but left out the column separator (&)on that line.

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

Gotta love those latex error descriptions!

Related Question