![表格格式不正确](https://linux22.com/image/378043/%E8%A1%A8%E6%A0%BC%E6%A0%BC%E5%BC%8F%E4%B8%8D%E6%AD%A3%E7%A1%AE.png)
为什么表格格式的小数仍然长于 2?
\begin{sidewaystable}
\centering
\footnotesize
\caption{P-value delle variabili nella regressione suddivisa per anno}
\label{tab:pvalue}
\begin{tabular}{l
S[round-precision=2]
S[round-precision=2]
S[round-precision=2]
S[round-precision=2]
S[round-precision=2]
S[round-precision=2]
S[round-precision=2]
S[round-precision=2]
S[round-precision=2]
S[round-precision=2]
}
\toprule
p-value & \multicolumn{1}{l}{2014h1} & & \multicolumn{1}{l}
{2014h2}
& & \multicolumn{1}{l}{2015h1} & & \multicolumn{1}{l}
{2015h2}
& & \multicolumn{1}{l}{2016h1} & \\
\toprule
& \multicolumn{1}{l}{Estimate} & \multicolumn{1}{l}{pValue} &
\multicolumn{1}{l}{Estimate} & \multicolumn{1}{l}{pValue} &
\multicolumn{1}{l}{Estimate} & \multicolumn{1}{l}{pValue} &
\multicolumn{1}{l}{Estimate} & \multicolumn{1}{l}{pValue} &
\multicolumn{1}{l}{Estimate} & \multicolumn{1}{l}{pValue} \\
(int.) & 3.5506 & 0 & 3.4812 & 0 & 3.4562 & 0 & 3.5235 & 0
& 3.6523 & 0 \\
CurrentInterestRateIndex & 0.69827 & 0 & & & &
& & & & \\
ObligorLegalFormBusinessTy & & & & & &
& & & & \\
BorrowerBaselIIISegment & & & & & & &
& & & \\
Seniority & 1.4895 & 0.0003 & 1.4935 & 0 & 0.59807 & 0.29 & 1.3258 &
0 & 0.94451 & 0 \\
InterestRateType & & & & & & &
& & & \\
code\_nace & 1.0486 & 0 & 0.95254 & 0.00342 & 0.79864 & 0.056 &
0.92741
& 0.06 & 0.94746 & 0.003 \\
NumberofCollateralItemsSecur & & & & & &
& & & & \\
WeightedAverageLife & 1.007 & 0 & 0.95374 & 0 & 1.1689 & 0 &
0.91267 & 0 & 0.79859 & 0 \\
maturity & & & & & & & & & & \\
payment\_ratio & 2.4564 & 0 & 2.2966 & 0 & 1.4822 & 0 & 2.3007 & 0 & 2.2537 & 0 \\
loanToValue & & & & & & & & & & \\
geographic\_area & 1.6753 & 0 & 1.4052 & 0.01893 & 1.432 & 0 & & & 0.90343 & 0.0217 \\
\bottomrule
\end{tabular}%
\end{sidewaystable}
答案1
除了添加选项之外round-mode=places
,您还应尝试让读者更轻松地解析表格。例如,您可能希望重新组织标题材料以提供更直观的分组。
\documentclass{article}
\usepackage{rotating,caption,booktabs,siunitx}
\usepackage[italian]{babel}
\begin{document}
\begin{sidewaystable}
\sisetup{round-mode=places,round-precision=2}
\centering
\footnotesize
\caption{P-value delle variabili nella regressione suddivisa per anno}
\label{tab:pvalue}
\begin{tabular}{@{} l *{10}{S} @{}}
\toprule
& \multicolumn{2}{c}{2014h1} & \multicolumn{2}{c}{2014h2}
& \multicolumn{2}{c}{2015h1} & \multicolumn{2}{c}{2015h2}
& \multicolumn{2}{c@{}}{2016h1} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}
\cmidrule(lr){8-9} \cmidrule(l){10-11}
& {Estimate} & {pValue} & {Estimate} & {pValue} & {Estimate} & {pValue} &
{Estimate} & {pValue} & {Estimate} & {pValue} \\
\midrule
(int.) & 3.5506 & 0 & 3.4812 & 0 & 3.4562 & 0 & 3.5235 & 0 & 3.6523 & 0 \\
CurrentInterestRateIndex & 0.69827 & 0 & & & & & & & & \\
ObligorLegalFormBusinessTy & & & & & & & & & & \\
BorrowerBaselIIISegment & & & & & & & & & & \\
Seniority & 1.4895 & 0.0003 & 1.4935 & 0 & 0.59807 & 0.29 & 1.3258 & 0 & 0.94451 & 0 \\
InterestRateType & & & & & & & & & & \\
code\_nace & 1.0486 & 0 & 0.95254 & 0.00342 & 0.79864 & 0.056 & 0.92741 & 0.06 & 0.94746 & 0.003 \\
NumberofCollateralItemsSecur & & & & & & & & & & \\
WeightedAverageLife & 1.007 & 0 & 0.95374 & 0 & 1.1689 & 0 & 0.91267 & 0 & 0.79859 & 0 \\
maturity & & & & & & & & & & \\
payment\_ratio & 2.4564 & 0 & 2.2966 & 0 & 1.4822 & 0 & 2.3007 & 0 & 2.2537 & 0 \\
loanToValue & & & & & & & & & & \\
geographic\_area & 1.6753 & 0 & 1.4052 & 0.01893 & 1.432 & 0 & & & 0.90343 & 0.0217 \\
\bottomrule
\end{tabular}
\end{sidewaystable}
\end{document}
答案2
您需要打开舍入(可能)round-mode=places
(还有round-mode=figures
)
\begin{tabular}{l
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
S[round-precision=2,round-mode=places]
}
如果所有列都设置相同的设置,则可以将定义简化为
\begin{tabular}{l*{10}{S[round-precision=2,round-mode=places]}}