我试图得到这样的东西:
---------------------------------
| Hello world | Again |
---------------------------------
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
---------------------------------
Run Code Online (Sandbox Code Playgroud)
所以我写道:
\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}
Run Code Online (Sandbox Code Playgroud)
但它给了我这个错误:
!错位\省略。\multispan ->\省略 \@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}
Run Code Online (Sandbox Code Playgroud)
要获取列之间的行,只需修改说明符:
\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}
Run Code Online (Sandbox Code Playgroud)