我尝试将表格制作成两列文档,但列与列之间的空间以及字体大小表格中的文字太大,超出了我想要填充的空间。我怎样才能稍微缩小列之间的空间并更改表格中文本的字体大小?
\begin{document}
\begin{table}
\centering
\begin{tabular}{@{}*4c@{}}
\toprule[1.5pt]
& BIAS & $\sigma$& OUT.[$\%$] \\
\hline
Five (17$\leq$ R $<$ 21) &-0.0099$\pm$0.0001&0.0004$\pm$0.05&0.003$\pm$0.0001 \\
Seventeen&0.0008$\pm$0.007&0.07$\pm$0.0004&0.0002$\pm$0.073\\
Five (21$\leq$ R $<$ 23)&-0.053$\pm$0.0015&0.0002$\pm$0.04&1.002$\pm$0.006\\
Seventeen&0.0001$\pm$0.01&0.007$\pm$0.004&0.0011$\pm$0.04\\
\bottomrule[1.5pt]
\end{tabular}
\end{table}
\end{document}
更新:根据给出的答案,我制作了另一张表格
\usepackage[separate-uncertainty,input-comparators]{siunitx}
\begin{document}
\begin{table}
\caption{The results }
\centering
\begin{tabular}{
l
S[table-format = -1.(1)]
S[table-format = 1.4]
S[table-format = 1.4]
S[table-format = 1.4]
}
\toprule[1.5pt]
APPROACH & {BIAS} &{$\sigma$} & {OUT. [\si{\percent}]} &{ODDS CUT}\\
\midrule
\textit{local} & -0.05 & 0.9 & 14.5 &\num{\ge0.0}\\
\textit{global}& 0.28 & 0.1 & 51.4 &\num{\ge0.0}\\
\midrule
\textit{local}& -0.6 & 0.21 & 1.7 &\num{\ge0.95}\\
\textit{global}& 0.3 & 0.29 & 10.2 &\num{\ge0.95}\\
\bottomrule[1.5pt]
\end{tabular}
\label{tab:ps}
\end{table}
\end{document}
我收到一条错误消息:
! siunitx error: "invalid-token-in-number"
!
! Invalid token '\ge ' in numerical input.
!
答案1
我会使用以下方法来实现siunitx
包裹:
\documentclass{article}
\usepackage{booktabs}
\usepackage[separate-uncertainty]{siunitx}
\begin{document}
\begin{table}
\small % change according to needs
\setlength\tabcolsep{6pt} % change according to needs
\centering
\begin{tabular}{
l
S[table-format = -1.4(1)]
*{2}{S[table-format = 1.4(1)]}
}
\toprule
& {BIAS} & {$\sigma$} & {OUT. [\si{\percent}]} \\
\midrule
Five ($17 \leq R < 21$) & -0.0099 \pm 0.0001 & 0.0004 \pm 0.05 & 0.003 \pm 0.0001 \\
Seventeen & 0.0008 \pm 0.007 & 0.07 \pm 0.0004 & 0.0002 \pm 0.073 \\
Five ($21 \leq R < 23$) & -0.053 \pm 0.0015 & 0.0002 \pm 0.04 & 1.002 \pm 0.006 \\
Seventeen & 0.0001 \pm 0.01 & 0.007 \pm 0.004 & 0.0011 \pm 0.04 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
更新
一般来说,最好在表格列中的标题内或标题下方声明重复的符号(单位等);这样更容易阅读。
以下是一个选项:
\documentclass{article}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{siunitx}
\DeclareCaptionLabelSeparator{spacing}{:\quad}
\captionsetup{
labelsep = spacing,
figureposition = bottom,
tableposition = top,
font = small,
labelfont = sc
}
\begin{document}
\begin{table}
\caption{The results.}
\centering
\begin{tabular}{
l
S[table-format = -1.2]
S[table-format = 1.2]
S[table-format = 2.1]
S[table-format = 1.2]
}
\toprule
APPROACH & {BIAS} &{$\sigma$} & {OUT. [\si{\percent}]} & {ODDS CUT ($\ge$)} \\
\midrule
\textit{local} & -0.05 & 0.9 & 14.5 & 0.0 \\
\textit{global}& 0.28 & 0.1 & 51.4 & 0.0 \\
\midrule
\textit{local} & -0.6 & 0.21 & 1.7 & 0.95 \\
\textit{global}& 0.3 & 0.29 & 10.2 & 0.95 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}