我正在尝试将此表复制到 TeX 中:
我对“高斯”等下的水平线有疑问。当我指定三个\cmidrule
时,它们不会分开,而是组合成一个大的\midrule
或\cline
。
如果有人能告诉我如何缩小此类范围,那就太好了\cmidrule
。提前谢谢!
这是我使用的(意大利面条式)代码:
\documentclass[bibtotoc,liststotoc,BCOR5mm,DIV12]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{colortbl,array} % für farbige cells
\usepackage{multirow,bigdelim}
\usepackage{booktabs}
\begin{document}
\begin{table}[htb]
\resizebox{\textwidth}{!}{
\begin{tabular}{lr rrrrrr rrrrrr rrrr}
\toprule
$f$ & $n$ & \multicolumn{6}{l}{Gaussian} & \multicolumn{6}{l}{Binomial Logit} & \multicolumn{4}{l}{Survival} \\ \cmidrule{3-8} \cmidrule{9-14} \cmidrule{15-18}
& & \multicolumn{2}{l}{FP} & \multicolumn{2}{l}{GCV} & \multicolumn{2}{l}{REML} & \multicolumn{2}{l}{FP} & \multicolumn{2}{l}{GCV} & \multicolumn{2}{l}{REML} & \multicolumn{2}{l}{FP} & AIC & REML \\
& & \makebox[1cm][l]{FP2}
& \makebox[1cm][l]{FP4} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{FP2} & \makebox[1cm][l]{FP4} & \makebox[1cm][l]{LRSS} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{LRSS}
& \makebox[1cm][l]{PS} & \makebox[1cm][l]{FP2} & \makebox[1cm][l]{FP4} & \makebox[1cm][l]{PS} & \makebox[1cm][l]{PS} \\ \midrule
& 100 & \cellcolor[gray]{0.8} 0.012 & \cellcolor[gray]{0.8} 0.012 & 0.021 & 0.025 & 0.018 & 0.018 & 0.043 & \cellcolor[gray]{0.8} 0.042 & 0.146 & 0.194 & 0.074 & 0.076 & \cellcolor[gray]{0.8} 0.015 & 0.016 & 0.427 & 0.019 \\
$f_1$ & 500 & 0.004 & \cellcolor[gray]{0.8} 0.002 & 0.006 & 0.006 & 0.004 & 0.004 & 0.014 & \cellcolor[gray]{0.8} 0.011 & 0.030 & 0.034 & 0.028 & 0.028 & 0.020 & 0.007 & 0.024 & \cellcolor[gray]{0.8} 0.005
\end{tabular}
}
\end{table}
\end{document}
答案1
命令\cmidrule
允许booktabs
使用可选参数括号 ( )
指定应该在哪一侧减少:
\cmidrule(r){3-8} \cmidrule(r){9-14} \cmidrule{15-18}
会缩短前两个规则的右端。您还可以在括号中添加金额,即(r{10pt})
并选择两侧(lr)
。有关更多详细信息,请参阅手册第 4 页中(l{5pt}r{10pt})
的描述。\cmidrule
booktabs