我有下表,其中小数对齐由siunitx
(MWE)处理:
\documentclass{scrartcl}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{siunitx}
\sisetup{
detect-mode,
group-digits = false,
input-symbols = ( ) [ ] - +,
table-align-text-post = false,
input-signs = ,
decimalsymbol=comma,
locale = DE,
} \usepackage{siunitx}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ccS[table-format = 2.8]S[table-format = 2.8]}
\toprule
& Parameter & {Estimate} & {Standard Error} \\
\midrule
EUR/USD model & $\hat \sigma_{X}$ & 0,0315 \\
[\defaultaddspace]
\multirow{4}{*}{GBP/USD model} & $\hat \omega$ & 0,000050 & 0,000045 \\
& $\hat \alpha_{Y}$ & 0,0860 & 0,0454 \\
& $\hat \beta_{Y}$ & 0,8585 & 0,0838 \\
& $\hat \nu$ & 7,6367 & 2,4094 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
这给了我:
我希望“估计值”和“标准误差”列中的条目位于列标题下方的中央(小数位仍然正确对齐)。我怀疑我必须更改,table-format
但我还没能找出正确的选项。
谢谢!
答案1
如果你想要小数点放置在列的中心——并在前导数字左侧产生大量浪费的空格——然后指定一个对称table-format
选项,例如table-format = 6.6
。
\documentclass{scrartcl}
\usepackage{booktabs}
%%\usepackage{multirow} % not needed
\usepackage{siunitx}
\sisetup{
detect-mode,
group-digits = false,
input-symbols = ( ) [ ] - +,
table-align-text-post = false,
input-signs = ,
%%decimalsymbol=comma, %% not needed, as implied by `locale=DE` option
locale = DE,
}
\begin{document}
\begin{table}
\centering
\begin{tabular}{@{} cc *{2}{S[table-format = 6.6]} @{}}
\toprule
& Parameter & {Estimate} & {Std.\ Error} \\
\midrule
EUR/USD model & $\hat \sigma_{X}$ & 0,0315 \\
[\defaultaddspace]
GBP/USD model & $\hat \omega$ & 0,000050 & 0,000045 \\
& $\hat \alpha_{Y}$ & 0,0860 & 0,0454 \\
& $\hat \beta_{Y}$ & 0,8585 & 0,0838 \\
& $\hat \nu$ & 7,6367 & 2,4094 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
我觉得桌子看起来好多了如果你设置table-format = 1.6
:
答案2
小数点前最多有 1 位数字,小数点后最多有 6 位数字。因此,您应该执行以下操作以获得所需的输出:
\documentclass{scrartcl}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage[
decimalsymbol = comma,
group-digits = false
]{siunitx}
\begin{document}
\begin{table}
\centering
\begin{tabular}{l c *{2}{S[table-format = 1.6]}
}
\toprule
& Parameter & {Estimate} & {Standard Error} \\
\midrule
EUR/USD model & $\hat\sigma_{X}$ & 0.0315 \\[1ex]
\multirow{4}{*}{GBP/USD model} & $\hat\omega$ & 0.000050 & 0.000045 \\
& $\hat\alpha_{Y}$ & 0.0860 & 0.0454 \\
& $\hat\beta_{Y}$ & 0.8585 & 0.0838 \\
& $\hat\nu$ & 7.6367 & 2.4094 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案3
% arara: pdflatex
\documentclass{scrartcl}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{siunitx}
\sisetup{%
detect-mode,
group-digits = false,
input-symbols = ( ) [ ] - +,
table-align-text-post = false,
input-signs = ,
output-decimal-marker =comma,
locale = DE,
}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ccS[table-format = 1.6]S[table-format = 1.6]}
\toprule
& Parameter & {Estimate} & {Standard Error} \\
\cmidrule(){2-4}
EUR/USD model & $\hat \sigma_{X}$ & 0,0315 \\
[\defaultaddspace]
\multirow{4}{*}{GBP/USD model} & $\hat \omega_{\phantom{Y}}$ & 0,000050 & 0,000045 \\
& $\hat \alpha_Y$ & 0,0860 & 0,0454 \\
& $\hat \beta_Y$ & 0,8585 & 0,0838 \\
& $\hat \nu_{\phantom{Y}}$ & 7,6367 & 2,4094 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}