我想在 LateX 中模仿下表:
我尝试过以下代码,但很难获得顶部的部分行(内容并不重要,只有顶行指定给“Tukey 比较”):
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}} ccccccc}
\hline\\[-1.8ex]
\multicolumn{6}{c}{Tukey’s HSD comparisons}\\
\hline\\[-1.8ex]
group & n & Mean & SD & 1998 & 1999 & 2000 \\
\hline\\[-1.8ex]
1998 & 256 & 79.71 & 13.40 & & & \\
1999 & 307 & 82.34 & 13.30 & .005 & & \\
2001 & 292 & 92.23 & 6.57 & $<$.001 & $<$.001 & $<$.032 \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}
答案1
将标题移动到最后三列:&&&&\multicolumn{3}{c}{Tukey’s HSD comparisons}
以及\cline
部分\cmidrule
规则(第一个具有更好的间距)
\documentclass{article}
\usepackage{booktabs}
\usepackage{caption}
\begin{document}
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}} ccccccc}
\toprule
&&&&\multicolumn{3}{c}{Tukey’s HSD comparisons}\\
\cmidrule{5-7}
group & n & Mean & SD & 1998 & 1999 & 2000 \\
\midrule
1998 & 256 & 79.71 & 13.40 & & & \\
1999 & 307 & 82.34 & 13.30 & .005 & & \\
2001 & 292 & 92.23 & 6.57 & $<$.001 & $<$.001 & $<$.032 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}