Latex多行合并/多列合并详解

1、宏包

在\begin{document}前加入宏包

\usepackage{multirow} 

2、多行合并

代码
三行合并

\multirow{3}{*}{a}

例子

\begin{center}
	\tabcaption{表}
	\label{tab:2}
	\renewcommand\tabcolsep{1pt}%调整表格长度
	\begin{tabular}
{cccccc}\toprule
        名称&名称&名称&名称&名称& 名称\\\midrule
		\multirow{3}{*}{a}&1&2&3&4&5\\
		&1&2&3&4&5\\
        &1&2&3&4&5\\\bottomrule
\end{tabular}\end{center}

在这里插入图片描述

3、多列合并

代码
四列合并

\multicolumn{4}{c}{3}
\begin{center}
	\tabcaption{表}
	\label{tab:2}
	\renewcommand\tabcolsep{1pt}%调整表格长度
	\begin{tabular}
{cccccc}\toprule
        名称&名称&名称&名称&名称& 名称\\\midrule
		\multirow{3}{*}{a}&1&\multicolumn{4}{c}{3}\\
		&1&2&3&4&5\\
        &1&2&3&4&5\\\bottomrule
\end{tabular}\end{center}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/iii66yy/article/details/132802121