siunitx
我刚刚发现我无法使用和包对小数点进行对齐longtable
。它会抛出错误,仅举几例:
Invalid numerical input 'e' Col1 & Col2 & n & Mean &
Duplicate exponent marker token '\token_to_str:N d' in input Col1 & Col2 & n & Mean & Median &
Invalid numerical input 'edi' Col1 & Col2 & n & Mean & Median &
Overfull \hbox (9.16669pt too wide) detected
这是上述问题的 MWE:
\documentclass{scrbook}
\usepackage[table-format=2.2]{siunitx}
\usepackage{longtable,booktabs}
\begin{document}
\begin{longtable}[l]{llcS[table-format=4.2]SSS}
\caption{Some caption here for the long table.}\label{tab:somelabel}\\
\toprule
Col1 & Col2 & n & Mean & Median & SD & P \\
\midrule
\endfirsthead
\midrule
Col1 & Col2 & n & Mean & Median & SD & P \\
\midrule
\endhead
\midrule
\endfoot
\midrule
\endlastfoot
A & Negative & 18 & 38.90 & 2.53 & 3.53 & 0.12 \\
A & Positive & 16 & 960.00 & 8.58 & 5.56 & \\
C & Negative & 18 & 98.50 & 1.14 & 1.48 & 0.75 \\
C & Positive & 16 & 59.40 & 3.51 & 5.19 & \\
A & Negative & 18 & 13.70 & 3.98 & 5.12 & 0.20 \\
A & Positive & 16 & 765.00 & 4.88 & 5.75 & \\
C & Negative & 18 & 33.80 & 2.64 & 3.85 & 0.10 \\
C & Positive & 16 & 645.00 & 19.30 & 27.20 & \\
A & Negative & 18 & 25.90 & 5.30 & 6.77 & 0.98 \\
A & Positive & 16 & 173.00 & 2.38 & 2.96 & \\
C & Negative & 18 & 182.00 & 9.10 & 13.30 & 0.03 \\
C & Positive & 16 & 6676.00 & 69.20 & 101.00 & \\
A & Negative & 18 & 3.57 & 1.87 & 1.70 & 0.38 \\
A & Positive & 16 & 108.00 & 1.93 & 1.51 & \\
C & Negative & 18 & 6.96 & 1.27 & 0.59 & 0.01 \\
C & Positive & 16 & 143.00 & 3.71 & 4.30 & \\
A & Negative & 18 & 14.90 & 2.07 & 2.64 & 0.04 \\
A & Positive & 16 & 693.00 & 7.03 & 8.37 & \\
C & Negative & 18 & 85.20 & 1.07 & 1.49 & 0.09 \\
C & Positive & 16 & 295.00 & 16.50 & 23.70 & \\
A & Negative & 18 & 82.70 & 6.19 & 7.42 & 0.31 \\
A & Positive & 16 & 1363.00 & 16.90 & 23.60 & \\
C & Negative & 18 & 63.70 & 2.15 & 2.78 & 0.03 \\
C & Positive & 16 & 1101.00 & 24.40 & 34.70 & \\
A & Negative & 18 & 91.40 & 18.30 & 26.00 & 0.39 \\
A & Positive & 16 & 3428.00 & 30.40 & 43.60 & \\
C & Negative & 18 & 37.00 & 11.90 & 17.60 & 0.84 \\
C & Positive & 16 & 1822.00 & 7.26 & 10.60 & \\
A & Negative & 18 & 14.10 & 4.44 & 3.65 & 0.20 \\
A & Positive & 16 & 404.00 & 4.27 & 5.22 & \\
C & Negative & 18 & 40.70 & 2.94 & 4.10 & 0.08 \\
C & Positive & 16 & 769.00 & 21.30 & 30.20 & \\
A & Negative & 18 & 6.28 & 2.19 & 2.11 & 0.31 \\
A & Positive & 16 & 397.00 & 5.25 & 7.63 & \\
C & Negative & 18 & 209.00 & 1.69 & 2.44 & 0.51 \\
C & Positive & 16 & 809.00 & 11.80 & 16.40 & \\
A & Negative & 18 & 712.00 & 15.40 & 22.10 & 0.63 \\
A & Positive & 16 & 3277.00 & 56.30 & 82.00 & \\
C & Negative & 18 & 2360.00 & 106.00 & 158.00 & 0.47 \\
C & Positive & 16 & 4877.00 & 148.00 & 218.00 & \\
A & Negative & 18 & 20.10 & 4.08 & 5.19 & 0.08 \\
A & Positive & 16 & 346.00 & 11.80 & 17.20 & \\
C & Negative & 18 & 4.63 & 1.03 & 1.05 & 0.03 \\
C & Positive & 16 & 276.00 & 7.14 & 10.20 & \\
\end{longtable}
\end{document}
笔记:
Texlive 2013
siunitx: 发布日期 2013/07/11
答案1
对于列中的非数字内容S
,通常应将单元格内容括在括号 ( {}
) 中。特别是,siunitx
使用字母e
表示具有科学计数法的数字,例如2e3
。2\times 10^3
这是您看到的错误的原因。因此,将两种情况都替换为
Col1 & Col2 & n & Mean & Median & SD & P \\
和
{Col1} & {Col2} & {n} & {Mean} & {Median} & {SD} & {P} \\
并且您的示例编译得很好。