在下表中,最左边的列应跨越两个 小型的行。如您所见,尽管文本被换行,但它适合第一行小型的排。
我想让文本换行,这样两个小型的行已被占用。
我该如何修复它?
\documentclass{article}
\usepackage{array}
\begin{document}
This is my table~\ref{t1}.
\begin{table*}
\centering
\small
\caption{my table}
\label{t1}
\begin{tabular}{ |>{\raggedright\centering\arraybackslash} p{2.5cm} |>{\raggedright\centering\arraybackslash} p{2.2cm}
|>{\raggedright\centering\arraybackslash} p{1.3cm} |>{\raggedright\centering\arraybackslash} p {1.3cm}
|>{\raggedright\centering\arraybackslash} p{1.3cm} |>{\raggedright\centering\arraybackslash} p{1.3cm}
|>{\raggedright\centering\arraybackslash} p{1.3cm} |>{\raggedright\centering\arraybackslash} p{1.3cm} |}
\cline{3-8}
\multicolumn{2}{c|}{} & bench s1 & bench s2 & bench s3 & bench s4 & bench s5 & bench s6 \\
\hline
my\_method\_1 (degree 2) & coverage (\%) & 11.15 & 12.57 & 2.78 & -17.74 & 11.52 & 8.97 \\
\cline{2-8}
& memread (\%) & 16.48 & 13.74 & 173.61 & 181.48 & 110.55 & 20.40 \\
\hline
my\_method\_2 (on miss) & coverage (\%) & 23.48 & 16.1 & 12.52 & 11.95 & 23.16 & 10.7 \\
\cline{2-8}
& memread (\%) & 44.55 & 60 & 52.91 & 55.32 & 36.58 & 52.19 \\
\hline
\end{tabular}
\end{table*}
\end{document}
答案1
您可以使用multirow
包并执行
\multirow{2}{2.2cm}{my\_method\_2 (on miss)}
对于两行。
\documentclass{article}
\usepackage{array,multirow}
\begin{document}
\begin{table}
\centering
\small
\caption{my table}
\label{t1}
\begin{tabular}{ *{8}{|c}|}
\cline{3-8}
\multicolumn{2}{c|}{} & bench s1 & bench s2 & bench s3 & bench s4 & bench s5 & bench s6 \\
\hline
\multirow{2}{2.2cm}{\centering my\_method\_1 (degree 2)} & coverage (\%) & 11.15 & 12.57 & 2.78 & -17.74 & 11.52 & 8.97 \\
\cline{2-8}
& memread (\%) & 16.48 & 13.74 & 173.61 & 181.48 & 110.55 & 20.40 \\
\hline
\multirow{2}{2.2cm}{\centering my\_method\_2 (on miss)} & coverage (\%) & 23.48 & 16.1 & 12.52 & 11.95 & 23.16 & 10.7 \\
\cline{2-8}
& memread (\%) & 44.55 & 60 & 52.91 & 55.32 & 36.58 & 52.19 \\
\hline
\end{tabular}
\end{table}
\end{document}