简要背景:S
我使用包提供的列类型创建了一个表siunitx
。此列类型可以很好地对齐数据和列标题。
我的问题:尽管将宽度设置为,但表格对于我的文档来说还是太宽了\textwidth
。我怀疑这是因为每列都使用相同的格式,并为前导(
和尾随留出了空间)
,即使每列都不需要。
口粮:
\documentclass[12pt,a4paper,titlepage,usenames]{article}
\usepackage[left=60mm,right=20mm,top=30mm,bottom=30mm]{geometry}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{tabu}
\begin{document}
\begin{table}[h]
\sisetup{
table-space-text-pre={(},
table-space-text-post={)},
input-open-uncertainty = ,
input-close-uncertainty = ,
table-format=2.2,
table-text-alignment=right,
table-align-text-pre = false,
table-align-text-post = false
}
\scriptsize
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}} *{11}{S}}
\toprule
$i$ & {$\beta^{1i}$} & {$\beta^{2i}$} & {$\beta^{3i}$} & {$\beta^{4i}$} & {$E(c^i)$} & {$\sigma(\Delta c^i)$} & {$E(r^{e,i})$} & {$\sigma(r^i)$} & {$trn^i$} & {$Size^i$} & {$BM^i$} \\
& {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(EUR)$} & \\
\midrule
1 & 1.43 & 0.00 & 0.00 & 0.00 & 0.26 & 0.00 & 0.96 & 1.97 & 0.50 & 28.45 & 3.14 \\
& (21.34) & (7.49) & (-6.67) & (-3.39) & & & & & & & \\
3 & 1.41 & 0.00 & 0.00 & 0.00 & 0.25 & -0.00 & 0.66 & 1.78 & 0.83 & 61.16 & 0.88 \\
& (29.14) & (9.91) & (-7.12) & (-1.27) & & & & & & & \\
5 & 1.30 & 0.00 & 0.00 & 0.00 & 0.25 & 0.00 & 1.56 & 2.11 & 14.69 & 5.45 & 0.00 \\
& (20.18) & (9.84) & (-4.12) & (-3.29) & & & & & & & \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
我的问题:TEX 能自动计算出正确的列宽吗?否则我怎样才能指定右侧的列不需要那么多的括号空间?
谢谢你,C。
答案1
您可以根据table-format
每个类型列的内容使用单独的选项。没有可选参数的类型列将使用命令内部指定的表格式。S
S
\sisetup
\documentclass[12pt,a4paper,titlepage]{article}
\usepackage[left=60mm,right=20mm,top=30mm,bottom=30mm]{geometry}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table}[h]
\sisetup{
table-space-text-pre={(},
table-space-text-post={)},
input-open-uncertainty = ,
input-close-uncertainty = ,
table-format=1.2,
table-text-alignment=right,
table-align-text-pre = false,
table-align-text-post = false
}
\scriptsize
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}
S[table-format=2.2]
S
*{2}{S[table-format=-1.2]}
*{4}{S}
*{2}{S[table-format=2.2]}
S}
\toprule
$i$ & {$\beta^{1i}$} & {$\beta^{2i}$} & {$\beta^{3i}$} & {$\beta^{4i}$} & {$E(c^i)$} & {$\sigma(\Delta c^i)$} & {$E(r^{e,i})$} & {$\sigma(r^i)$} & {$trn^i$} & {$Size^i$} & {$BM^i$} \\
& {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(EUR)$} & \\
\midrule
1 & 1.43 & 0.00 & 0.00 & 0.00 & 0.26 & 0.00 & 0.96 & 1.97 & 0.50 & 28.45 & 3.14 \\
& (21.34) & (7.49) & (-6.67) & (-3.39) & & & & & & & \\
3 & 1.41 & 0.00 & 0.00 & 0.00 & 0.25 & -0.00 & 0.66 & 1.78 & 0.83 & 61.16 & 0.88 \\
& (29.14) & (9.91) & (-7.12) & (-1.27) & & & & & & & \\
5 & 1.30 & 0.00 & 0.00 & 0.00 & 0.25 & 0.00 & 1.56 & 2.11 & 14.69 & 5.45 & 0.00 \\
& (20.18) & (9.84) & (-4.12) & (-3.29) & & & & & & & \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
答案2
我建议减少到 3.5pt 并从第一列\tabcolsep
开始应用:@{\extracolsep{\fill}}
\documentclass[12pt, a4paper, titlepage, usenames]{article}
\usepackage[left=60mm, right=20mm, vmargin=30mm, showframe]{geometry}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table}[h]
\centering
\setlength{\tabcolsep}{3.5pt}
\sisetup{
table-space-text-pre={(},
table-space-text-post={)},
input-open-uncertainty = ,
input-close-uncertainty = ,
table-format=2.2,
table-text-alignment=right,
table-align-text-pre = false,
table-align-text-post = false
}
\scriptsize
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}l*{11}{S}}
\toprule
$i$ & {$\beta^{1i}$} & {$\beta^{2i}$} & {$\beta^{3i}$} & {$\beta^{4i}$} & {$E(c^i)$} & {$\sigma(\Delta c^i)$} & {$E(r^{e,i})$} & {$\sigma(r^i)$} & {$trn^i$} & {$Size^i$} & {$BM^i$} \\
& {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\cdot 100)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(\%)$} & {$(EUR)$} & \\
\midrule
1 & 1.43 & 0.00 & 0.00 & 0.00 & 0.26 & 0.00 & 0.96 & 1.97 & 0.50 & 28.45 & 3.14 \\
& (21.34) & (7.49) & (-6.67) & (-3.39) & & & & & & & \\
3 & 1.41 & 0.00 & 0.00 & 0.00 & 0.25 & -0.00 & 0.66 & 1.78 & 0.83 & 61.16 & 0.88 \\
& (29.14) & (9.91) & (-7.12) & (-1.27) & & & & & & & \\
5 & 1.30 & 0.00 & 0.00 & 0.00 & 0.25 & 0.00 & 1.56 & 2.11 & 14.69 & 5.45 & 0.00 \\
& (20.18) & (9.84) & (-4.12) & (-3.29) & & & & & & & \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}