我想得到这样的东西:
---------------------------------
| Hello world | Again |
---------------------------------
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
---------------------------------
所以我写道:
\begin{tabular}{l|l|l}
\multicolumn{4}{c}{Población total en millones}
\multicolumn{4}{c}{Porcentaje de población rural}\\
\hline
1975 & 2001 & 2003 & 2015 & 1975 & 2001 & 2003 & 2015\\
\hline
10,3 & 15,4 & 16 & 17,9 & 21,6 & 14 & 13 & 9,8
\end{tabular}
但它给了我这个错误:
! Misplaced \omit. \multispan ->\omit \@multispan
我能做什么?
编辑
另外,如何在两列之间设置边框?
谢谢。
最佳答案
您需要先设置 8 列,然后跨越到它。 :)
跨列也应由 &
对齐运算符分隔。
\begin{tabular}{l|l|l|l|l|l|l|l}
\multicolumn{4}{c}{Poblaci\'{o}n total en millones} &
\multicolumn{4}{c}{Porcentaje de poblaci\'{o}n rural}\\
\hline
1975 & 2001 & 2003 & 2015 & 1975 & 2001 & 2003 & 2015\\
\hline
10,3 & 15,4 & 16 & 17,9 & 21,6 & 14 & 13 & 9,8
\end{tabular}
要获得列之间的线,只需修改说明符:
\begin{tabular}{l|l|l|l|l|l|l|l}
\multicolumn{4}{c|}{Poblaci\'{o}n total en millones} &
\multicolumn{4}{|c}{Porcentaje de poblaci\'{o}n rural}\\
\hline
1975 & 2001 & 2003 & 2015 & 1975 & 2001 & 2003 & 2015\\
\hline
10,3 & 15,4 & 16 & 17,9 & 21,6 & 14 & 13 & 9,8
\end{tabular}
More information on table formatting is over at WikiBooks. :)
关于latex - 如何在 LaTeX 表中获取两个\多列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2971328/