谁能帮我去掉第一列的多余宽度,目标是像第二幅图像(取自word)那样 - 代码如下,生成下面的图像 1。
\begin{table}[]
\centering
\def\arraystretch{1.5}%
\resizebox{\textwidth}{!}{%
\begin{tabular}{ccccccccc}
\hline
& \multicolumn{4}{c}{Experiment 2} & \multicolumn{4}{c}{Experiment 4} \\ \cline{2-9}
& 3.5° & 7° & 10.5° & 14° & 0.875° & 1.75° & 3.5° & 10.5° \\ \hline
Size & 4.00 & 5.77 & 7.54 & 9.32 & 1.34 & 1.56 & 2.00 & 3.77 \\
Scale Factor & 1.00 & 1.44 & 1.89 & 2.33 & 0.33 & 0.39 & 0.50 & 0.94 \\ \hline
SpatialFrequency & 1.00 & 0.69 & 0.53 & 0.43 & 1.50 & 1.28 & 1.00 & 0.53 \\
Scale Factor & 1.00 & 0.69 & 0.53 & 0.43 & 1.50 & 1.28 & 1.00 & 0.53 \\ \hline
\stoptable{\textit{Note: Scale factors are relative to the size and spatial frequency of the 3.5° condition in Experiment 2.}}
\end{tabular}%
}
\caption{Sizes, spatial frequencies, and their associated scale factors for the four eccentricity conditions in Experiments 2 and 4.}
\label{tab2_9}
\end{table}
答案1
与。{NiceTabular}
nicematrix
\documentclass{article}
\usepackage{nicematrix}
\usepackage{booktabs}
\usepackage{caption}
\begin{document}
\begin{table}
\centering
\begin{NiceTabular}{@{}l*{8}{X[c]}@{}}%
[tabularnote = \itshape Scale factors are relative to the size and
spatial frequency of the 3.5° condition in Experiment 2. ]
\toprule
\RowStyle[bold]{}
& \Block{1-4}{Experiment 2} & & & & \Block{1-4}{Experiment 4} \\
\cmidrule(r){2-5}
\cmidrule(l){6-9}
& 3.5° & 7° & 10.5° & 14°
& 0.875° & 1.75° & 3.5° & 10.5° \\
\midrule
Size & 4.00 & 5.77 & 7.54 & 9.32 & 1.34 & 1.56 & 2.00 & 3.77 \\
Scale Factor
& 1.00 & 1.44 & 1.89 & 2.33 & 0.33 & 0.39 & 0.50 & 0.94 \\ \midrule
Spatial Frequency
& 1.00 & 0.69 & 0.53 & 0.43 & 1.50 & 1.28 & 1.00 & 0.53 \\
Scale Factor
& 1.00 & 0.69 & 0.53 & 0.43 & 1.50 & 1.28 & 1.00 & 0.53 \\
\bottomrule
\end{NiceTabular}
\caption{Sizes, spatial frequencies, and their associated scale factors for the four eccentricity conditions in Experiments 2 and 4.}
\label{tab2_9}
\end{table}
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。
答案2
另一种方法是使用tabularray
包。其talltblr
环境提供了remark
下表中注释的功能:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{table}
\centering
\DefTblrTemplate{firsthead}{default}{} % <---
\SetTblrStyle{remark}{\small\itshape}
\begin{talltblr}[
remark{Note} = {Scale factors are relative to the size and spatial frequency of the \ang{3.5} condition in Experiment 2.}
]{colsep=2pt,
colspec = {@{} l*{8}{X[c, si={table-format=1.2{*}}]}
@{} },
row{1} = {font=\bfseries}
}
\toprule
&\SetCell[c=4]{c} {{{Experiment 2}}}
& & & &\SetCell[c=4]{c} {{{Experiment 4}}}
& & & \\
\cmidrule[r]{2-5}
\cmidrule[l]{6-9}
& \ang{3.5} & \ang{7} & \ang{10.5} & \ang{14}
& \ang{0.875} & \ang{1.75} & \ang{3.5} & \ang{10.5} \\
\midrule
Size & 4.00 & 5.77 & 7.54 & 9.32 & 1.34 & 1.56 & 2.00 & 3.77 \\
Scale Factor
& 1.00 & 1.44 & 1.89 & 2.33 & 0.33 & 0.39 & 0.50 & 0.94 \\ \midrule[dashed]
Spatial Frequency
& 1.00 & 0.69 & 0.53 & 0.43 & 1.50 & 1.28 & 1.00 & 0.53 \\
Scale Factor
& 1.00 & 0.69 & 0.53 & 0.43 & 1.50 & 1.28 & 1.00 & 0.53 \\
\bottomrule
\end{talltblr}
\caption{Sizes, spatial frequencies, and their associated scale factors for the four eccentricity conditions in Experiments 2 and 4.}
\label{tab2_9}
\end{table}
\end{document}
答案3
该\stoptable
指令——您是否可能从基于 ConTeXt 的示例中复制了它?——似乎没有定义。因此,LaTeX 只是将指令的参数转储到恰好是第一列的位置。正如其他人已经指出的那样,只需将图例以下主要表格材料。
我还强烈建议您不要\resizebox
对表格施加大锤,而是使用tabularx
环境并将X
列类型应用于第一列。用包的宏替换\hline
和也是一个不错的选择。\cline
booktabs
\documentclass{article}
\usepackage{tabularx,booktabs}
\begin{document}
\begin{table}[htbp]
\begin{tabularx}{\textwidth}{@{} X *{8}{c} @{}}
\toprule
& \multicolumn{4}{c}{Experiment 2}
& \multicolumn{4}{c@{}}{Experiment 4} \\
\cmidrule(lr){2-5} \cmidrule(l){6-9}
& 3.5° & 7° & 10.5° & 14° & 0.875°& 1.75°& 3.5° & 10.5° \\
\midrule
Size & 4.00 & 5.77 & 7.54 & 9.32 & 1.34 & 1.56 & 2.00 & 3.77 \\
Scale Factor & 1.00 & 1.44 & 1.89 & 2.33 & 0.33 & 0.39 & 0.50 & 0.94 \\
\addlinespace
Spatial Frequency & 1.00 & 0.69 & 0.53 & 0.43 & 1.50 & 1.28 & 1.00 & 0.53 \\
Scale Factor & 1.00 & 0.69 & 0.53 & 0.43 & 1.50 & 1.28 & 1.00 & 0.53 \\
\bottomrule
\addlinespace
\multicolumn{9}{@{}p{\textwidth}@{}}{\small\textit{Note}:
Scale factors are relative to the size and spatial frequency
of the 3.5° condition in Experiment 2.}
\end{tabularx}
\caption{Sizes, spatial frequencies, and associated scale factors for the four eccentricity conditions in Experiments 2 and 4.}
\label{tab2_9}
\end{table}
\end{document}