我在“跨多行列”部分中找到了一个例子 表格示例 我有:
\begin
{tabular}{ |l|l|l|l| }
\hline
\multicolumn{4}{ |c| }{mytable} \\
\hline
C1 & C2 & C3 & C4 \\ \hline
\multirow{7}{*}{spring} & \multirow{5}{*}{mvc} & \multirow{3}{*}{pull} & A \\
& B \\
& C \\
& review & A \\
& push & A \\
& boot & same as above & \\
& cloud & same as above & \\
\hline
\end{tabular}
答案1
表格中只缺少几个&
。即使使用了,也\multirow
必须将&
放到下一列,否则会有一些文本重叠。
我修复了你的表格并制作了它的第二个版本,规则更少,并使用booktabs
包使其看起来更简洁:
\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{ |l|l|l|l| }
\hline
C1 & C2 & C3 & C4 \\ \hline
\multirow{7}{*}{spring} & \multirow{5}{*}{mvc} & \multirow{3}{*}{pull} & A \\\cline{4-4}
&&& B \\\cline{4-4}
&&& C \\\cline{3-4}
&& review & A \\\cline{3-4}
&& push & A \\\cline{2-4}
& boot & \multicolumn{2}{l|}{same as above} \\\cline{2-4}
& cloud & \multicolumn{2}{l|}{same as above} \\\cline{2-4}
\hline
\end{tabular}
\bigskip
\begin{tabular}{llll}
\toprule
C1 & C2 & C3 & C4 \\ \midrule
\multirow{7}{*}{spring} & \multirow{5}{*}{mvc} & \multirow{3}{*}{pull} & A \\
&&& B \\
&&& C \\\cmidrule{3-4}
&& review & A \\
&& push & A \\\cmidrule{2-4}
& boot & \multicolumn{2}{l}{same as above} \\
& cloud & \multicolumn{2}{l}{same as above} \\
\bottomrule
\end{tabular}
\end{document}