我的 LaTeX 代码有问题,顶部规则、中间规则和底部规则的长度与数据不匹配。我该如何更改表格规则的长度,以便标题和列名清晰地分开?
\documentclass[a4paper,11pt]{article}
\usepackage{lscape}
\usepackage{booktabs,dcolumn,caption}
\captionsetup{labelsep=newline,
singlelinecheck=false,
skip=0.333\baselineskip}
\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
\renewcommand{\ast}{{}^{\textstyle *}} % for raised "asterisks"
\begin{landscape}
\begin{table}[h]
\setlength\tabcolsep{0pt} % let LaTeX figure out amount of inter-column whitespace
\caption*{MNI maximum coordinates,cluster size,p-values of resting state statistical maps for seed Cornu Ammonis.}
\label{turns}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{20}{d{2.4}} }
\toprule
\multicolumn{1}{c}{Brain area} & \multicolumn{1}{c}{Cluster size } && \multicolumn{1}{c}{Coordinates} && \multicolumn{1}{c}{p-unc} && \multicolumn{1}{c}{p-FDR} && \multicolumn{1}{c}{p-FWE}\\
& \multicolumn{1}{c}{(voxels)} && \multicolumn{1}{c}{x y z} & \\
\midrule
Right inferior parietal lobule & 132 & -0.002 & 1.155\ast \\
& (1.22) & (2.22) & (0.56)\\
Right inferior occipitofrontal fasciculus & 0.025\ast & -0.002 & 1.155\ast \\
& (1.22) & (2.22) & (0.56)\\
Right visual cortex V5
& 0.025\ast & -0.002 & 1.155\ast \\
& (1.22) & (2.22) & (0.56)\\
Right inferior parietal lobule
& 0.025\ast & -0.002 & 1.155\ast \\
& (1.22) & (2.22) & (0.56)\\
\bottomrule
\end{tabular*}
\end{table}
\end{landscape}
\end{document}
答案1
您可以在进入横向模式之前保存页面的高度,然后将其用作表格的宽度。将以下内容放入序言中,添加\begin{document}
:
\newlength{\saveheight}
\setlength{\saveheight}{\textheight}
\begin{document}
然后开始你的表使用:
\begin{tabular*}{\saveheight}{@{\extracolsep{\fill}} l *{20}{d{2.4}} }
附录:我只是看到了 Leandiis 的建议,使用,这是获得相同结果的更简单的方法。(如果您采用带标题的双页格式,则\linewidth
使用\savewidth
上述方法可以进行进一步的操作,例如等。)\addtolength{\saveheight}{\headheight}