我正在尝试用 LaTeX 编写列标题,以便每个标题跨越两列;但是,以下代码不起作用:
\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
应该跨越前两列,也Liabilities and Equities
应该跨越第二对。当我编译它时,我收到此错误:
Misplaced \omit.
\multispan ->\omit
\@multispan
l.221 ...lticolumn{2}{c}{Liabilities and Equities}
答案1
看来您做得正确,但是遗漏了&
该行的列分隔符()。
\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}
非常喜欢这些乳胶错误描述!