在制作LaTex表格的时候,常常需要合并行和列,本文介绍的是使用 multirow 包里面的命令完成合并行列的方法。
代码
\begin{table*}
%\usepackage{multirow}
\center
\begin{tabular}{|c|c|c|c|c|}
\hline % horizontal line
\multirow{2}{*}{1 \& 2} & \multicolumn{2}{l|}{ 3 \& 4 } & 5 & 6\\ %end line
\cline{2-5} %short partial horizontal lines from column 2 to column 5
& 7 & 8 & 9 & 10\\ %first cell is occupied by the multirow
\hline
\hline
$ s_{1} $ & 2 & 3 & 4 & 5\\
$ s_{2} $ & 2 & 3 & 4 & 5\\
\hline
\hline
$ s_{3} $ & 2 & 3 & 4 & 5\\
$ s_{4} $ & 2 & 3 & 4 & 5\\
\hline
\end{tabular}
\end{table*}
效果
拓展
如果这种方法不能满足制作表格的特色要求,可以考虑使用 makecell 包里面的命令实现。