我正在尝试理解以下代码。 \ra 起什么作用?
\begin{table*}\centering
\ra{1.3}
\begin{tabular}{@{}rrrrcrrrcrrr@{}}\toprule
& \multicolumn{3}{c}{$w = 8$} & \phantom{abc}& \multicolumn{3}{c}{$w = 16$} &
\phantom{abc} & \multicolumn{3}{c}{$w = 32$}\\
\cmidrule{2-4} \cmidrule{6-8} \cmidrule{10-12}
& $t=0$ & $t=1$ & $t=2$ && $t=0$ & $t=1$ & $t=2$ && $t=0$ & $t=1$ & $t=2$\\ \midrule
$dir=1$\\
$c$ & 0.0790 & 0.1692 & 0.2945 && 0.3670 & 0.7187 & 3.1815 && -1.0032 & -1.7104 & -21.7969\\
$c$ & -0.8651& 50.0476& 5.9384&& -9.0714& 297.0923& 46.2143&& 4.3590& 34.5809& 76.9167\\
$c$ & 124.2756& -50.9612& -14.2721&& 128.2265& -630.5455& -381.0930&& -121.0518& -137.1210& -220.2500\\
$dir=0$\\
$c$ & 0.0357& 1.2473& 0.2119&& 0.3593& -0.2755& 2.1764&& -1.2998& -3.8202& -1.2784\\
$c$ & -17.9048& -37.1111& 8.8591&& -30.7381& -9.5952& -3.0000&& -11.1631& -5.7108& -15.6728\\
$c$ & 105.5518& 232.1160& -94.7351&& 100.2497& 141.2778& -259.7326&& 52.5745& 10.1098& -140.2130\\
\bottomrule
\end{tabular}
\caption{Caption}
\end{table*}
答案1
你很可能会发现
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
在您的文档中,但我认为您不应该使用它。\ra{1.3}
行距将增加 30%,这在某些情况下很有用,但在这里它只会分散数据而没有任何实际好处。
相反,你应该用一小段垂直空间将表格的两个部分分开。另外,\phantom{abc}
列只是浪费空间。使用siunitx
和S
列可以提供一致的数字排版。
\documentclass{article}
\usepackage[margin=0.5cm]{geometry}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table*}
\centering
\begin{tabular}{@{}r*{9}{S[table-format=-3.4]}@{}}
\toprule
& \multicolumn{3}{c}{$w = 8$} & \multicolumn{3}{c}{$w = 16$} & \multicolumn{3}{c}{$w = 32$}\\
\cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(l){8-10}
& {$t=0$} & {$t=1$} & {$t=2$} & {$t=0$} & {$t=1$} & {$t=2$} & {$t=0$} & {$t=1$} & {$t=2$} \\
\midrule
$dir=1$\\
$c$ & 0.0790 & 0.1692 & 0.2945 & 0.3670 & 0.7187 & 3.1815 & -1.0032 & -1.7104 & -21.7969\\
$c$ & -0.8651& 50.0476& 5.9384& -9.0714& 297.0923& 46.2143& 4.3590& 34.5809& 76.9167\\
$c$ & 124.2756& -50.9612& -14.2721& 128.2265& -630.5455& -381.0930& -121.0518& -137.1210& -220.2500\\
\addlinespace
$dir=0$\\
$c$ & 0.0357& 1.2473& 0.2119& 0.3593& -0.2755& 2.1764& -1.2998& -3.8202& -1.2784\\
$c$ & -17.9048& -37.1111& 8.8591& -30.7381& -9.5952& -3.0000& -11.1631& -5.7108& -15.6728\\
$c$ & 105.5518& 232.1160& -94.7351& 100.2497& 141.2778& -259.7326& 52.5745& 10.1098& -140.2130\\
\bottomrule
\end{tabular}
\caption{Caption}
\end{table*}
\end{document}