我制作了这张带有合并标题的表格,但我不知道为什么我无法将术语“IL 结果”和“随机测试集”垂直对齐。我的代码可能看起来有点混乱,因为有很多列分割和数学文本,但我把它放在下面了。也许有人有建议。
谢谢你!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\begin{document}
\begin{table}[htbp]
\caption{Model Results I}
\begin{center}
\begin{tabular}{|cc|c|c|c|c|c|c|c|}
\hline
\multicolumn{1}{|c|}{\multirow{3}{*}{
\textbf{{\begin{tabular}[c]{@{}c@{}}
\\IL\\Results\end{tabular}}}}}&
\multicolumn{1}{|c|}{\multirow{3}{*}{
\textbf{{\begin{tabular}[c]{@{}c@{}}
\\Random\\testset\end{tabular}}}
}}&
\multicolumn{5}{c|}{\textbf{Journey Model}}\\
\cline{3-7}
\multicolumn{1}{|c|}{} & &
\textbf{D003}&
\textbf{D004}&
\textbf{D003}&
\textbf{D003}&
\multirow{2}{*}{\textbf{Total}} \\
\multicolumn{1}{|c|}{} & &
\textbf{$\mathbf{3\phi}$}&
\textbf{$\mathbf{3\phi}$}&
\textbf{$\mathbf{1\phi}$}&
\textbf{$\mathbf{2\phi}$}& \\ \hline
\multicolumn{1}{|c|}{D003} & 2 & 7 & 2 & 7 & 3 & 19\\ \hline
\multicolumn{1}{|c|}{D004} & 11 & 3 & 1 & 12 & 5 & 21\\ \hline
\multicolumn{1}{|c|}{Other IL} & 101 & 89 & 64 & 75 & 64 & 292\\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}\begin{scriptsize}All\end{scriptsize}\\\begin{scriptsize}Inspections\end{scriptsize}\end{tabular}} & 114 & 99 & 67 & 94 & 72 & 332\\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}} \begin{scriptsize}General \end{scriptsize}\\ \begin{scriptsize}Success Rate \end{scriptsize}\end{tabular}}&
11.4\%&
\begin{scriptsize}10.1\%\end{scriptsize} & \begin{scriptsize}4.5\%\end{scriptsize} & \begin{scriptsize}20.2\% \end{scriptsize}& \begin{scriptsize}11.1\% \end{scriptsize}& \begin{scriptsize}12.0\%\end{scriptsize}\\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}\begin{scriptsize}D003\end{scriptsize}\\ \begin{scriptsize}Success Rate \end{scriptsize}\end{tabular}}
&1.8\%&
\begin{scriptsize}7.1\% \end{scriptsize}& \begin{scriptsize}3.0\% \end{scriptsize}& \begin{scriptsize}7.4\% \end{scriptsize}& \begin{scriptsize}4.2\% \end{scriptsize}& \begin{scriptsize}5.7\%\end{scriptsize}\\ \hline
%#### END TABLE
\end{tabular}
\label{tab-results}
\end{center}
\end{table}
%#### END TABLE
\end{document}
答案1
关键是要不断尝试——不要使用 3 行,而是尝试使用 2.5 行或 2.4 行进行多行布局
{\multirow{2.5}{*}{\textbf{IL Results}}}
建议删除主表格之间的 scriptsize 和 tabular
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{booktabs}
\begin{document}
\begin{table}[htbp]
\caption{Model Results I}
\begin{center}
\begin{tabular}{ccccccccc} \toprule
{\multirow{2.5}{*}{\textbf{IL Results}}}&{\multirow{2.5}{*}{\textbf{Random testset}}}&\multicolumn{5}{c}{\textbf{Journey Model}}\\ \cline{3-7}
& &\textbf{D003}&\textbf{D004}&\textbf{D003}&\textbf{D003}&\multirow{2}{*}{\textbf{Total}} \\
& &\textbf{$\mathbf{3\phi}$}&\textbf{$\mathbf{3\phi}$}&\textbf{$\mathbf{1\phi}$}&\textbf{$\mathbf{2\phi}$}& \\ \hline
\multicolumn{1}{c}{D003} & 2 & 7 & 2 & 7 & 3 & 19\\ \hline
\multicolumn{1}{c}{D004} & 11 & 3 & 1 & 12 & 5 & 21\\ \hline
\multicolumn{1}{c}{Other IL} & 101 & 89 & 64 & 75 & 64 & 292\\ \hline
\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}\begin{scriptsize}All\end{scriptsize}\\\begin{scriptsize}Inspections\end{scriptsize}\end{tabular}} & 114 & 99 & 67 & 94 & 72 & 332\\ \hline
\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}} \begin{scriptsize}General \end{scriptsize}\\ \begin{scriptsize}Success Rate \end{scriptsize}\end{tabular}}&
11.4\%&
\begin{scriptsize}10.1\%\end{scriptsize} & \begin{scriptsize}4.5\%\end{scriptsize} & \begin{scriptsize}20.2\% \end{scriptsize}& \begin{scriptsize}11.1\% \end{scriptsize}& \begin{scriptsize}12.0\%\end{scriptsize}\\ \hline
\multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}\begin{scriptsize}D003\end{scriptsize}\\ \begin{scriptsize}Success Rate \end{scriptsize}\end{tabular}}
&1.8\%&
\begin{scriptsize}7.1\% \end{scriptsize}& \begin{scriptsize}3.0\% \end{scriptsize}& \begin{scriptsize}7.4\% \end{scriptsize}& \begin{scriptsize}4.2\% \end{scriptsize}& \begin{scriptsize}5.7\%\end{scriptsize}\\ \bottomrule
%#### END TABLE
\end{tabular}
\label{tab-results}
\end{center}
\end{table}
%#### END TABLE
\end{document}