在下面的 MWE 中创建的表格中,我希望 crule 和第三行之间的间距稍微大一些,而第二行文本和 crule 之间的间距稍微小一些。我该怎么做?
\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\begin{document}
\renewcommand{\arraystretch}{1.2}
\begin{table}[tp]
\caption{Minimum Working Example}
\centering
\begin{tabular}{cccc}
\toprule
& & \multicolumn{2}{c}{First Dimension} \\
& & 1st D Value 1 & 1st D Value 2 \\ \cline{3-4}
\multirow{2}*{Second dimension} & 2nd D Value1 & Outcome(1,1) & Outcome(1,2) \\
& 2nd D Value2 & Outcome(2,1) & Outcome(2,2) \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
中没有\crule
宏booktabs
,但是\cmidrule
,与 含义相同\cline
,但提供更多空间。
如果常规间距(由\aboverulesep
和控制\bottomrulesep
)不够,则\addlinespace
可以注入显式间距:
\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\newlength{\ridiculouslylargecmidrulesep}
\setlength{\ridiculouslylargecmidrulesep}{50pt}
\begin{document}
\renewcommand{\arraystretch}{1.2}
\begin{table}[tp]
\caption{Minimum Working Example}
\centering
\begin{tabular}{cccc}
\toprule
& & \multicolumn{2}{c}{First Dimension} \\
& & 1st D Value 1 & 1st D Value 2 \\ \cmidrule{3-4}
\multirow{2}*{Second dimension} & 2nd D Value1 & Outcome(1,1) & Outcome(1,2) \\
& 2nd D Value2 & Outcome(2,1) & Outcome(2,2) \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}[tp]
\caption{Minimum Working Example}
\centering
\begin{tabular}{cccc}
\toprule
& & \multicolumn{2}{c}{First Dimension} \\
& & 1st D Value 1 & 1st D Value 2 \\ \addlinespace[\ridiculouslylargecmidrulesep]
\cmidrule{3-4} \addlinespace[\ridiculouslylargecmidrulesep]
\multirow{2}*{Second dimension} & 2nd D Value1 & Outcome(1,1) & Outcome(1,2) \\
& 2nd D Value2 & Outcome(2,1) & Outcome(2,2) \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
我认为,您的表格可能是罕见的情况,如果使用\hline
和\cline
以及适当放置的垂直线,比使用包的线条绘制宏看起来更好booktabs
。
\documentclass{article}
\usepackage{multirow}
\usepackage[skip=0.333\baselineskip]{caption}
\begin{document}
\begin{table}[ht!]
\renewcommand{\arraystretch}{1.6}
\caption{Minimum Working Example}
\centering
\begin{tabular}{|*{4}{c|}}
\cline{3-4}
\multicolumn{2}{c|}{} & \multicolumn{2}{c|}{First Dimension} \\
\cline{3-4}
\multicolumn{2}{c|}{} & 1st D Value 1 & 1st D Value 2 \\
\hline
\multirow{2}{*}{Second dimension} & 2nd D Value1 & Outcome(1,1) & Outcome(1,2) \\
\cline{2-4}
& 2nd D Value2 & Outcome(2,1) & Outcome(2,2) \\
\hline
\end{tabular}
\end{table}
\end{document}