表格中浮点数的格式化和对齐

表格中浮点数的格式化和对齐

我有下表:

\documentclass{report}

\usepackage[intlimits]{amsmath}          
\usepackage{floatflt}
\usepackage{caption}
\usepackage{listliketab}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}[htmb]
\caption{Koeffizienten und Exponenten der Gl. \ref{eq:BG_T_ps}} \label{tab_koeff_T_ps}
\begin{tabular}{ccclcccl}
\toprule
$i$ & $I_i$ & $J_i$ & \multicolumn{1}{c}{$n_i$} & $i$ & $I_i$ & $J_i$ & \multicolumn{1}{c}{$n_i$}\\ \midrule
\num{1} & \num{0} & \num{0} & \num{0.1747826805830} $\times 10^3$ & \num{11} & \num{1} & \num{12} & \num{0.3567211060736} $\times 10^{-9}$ \\
\num{2} & \num{0} & \num{1} & \num{0.3480693089287} $\times 10^2$ & \num{12} & \num{1} & \num{31} & \num{0.1733249699489} $\times 10^{-23}$ \\
\num{3} & \num{0} & \num{2} & \num{0.6529258497845} $\times 10$ & \num{13} & \num{2} & \num{0} & \num{0.5660890065483} $\times 10^{-3}$ \\
\num{4} & \num{0} & \num{3} & \num{0.33039981775489} & \num{14} & \num{2} & \num{1} & \num{-0.3263548313971} $\times 10^{-3}$ \\
\num{5} & \num{0} & \num{11} & \num{-0.1928138292319} $\times 10^{-6}$ & \num{15} & \num{2} & \num{2} & \num{0.4477828669063} $\times 10^{-4}$ \\
\num{6} & \num{0} & \num{31} & \num{-0.2490919724457} $\times 10^{-22}$ & \num{16} & \num{2} & \num{9} & \num{-0.5132215690850} $\times 10^{-9}$ \\
\num{7} & \num{1} & \num{0} & \num{-0.26107636489332} & \num{17} & \num{2} & \num{31} & \num{-0.4252265704220} $\times 10^{-25}$ \\
\num{8} & \num{1} & \num{1} & \num{0.22592965981586} & \num{18} & \num{3} & \num{10} & \num{0.2640044136068} $\times 10^{-12}$ \\
\num{9} & \num{1} & \num{2} & \num{-0.6425646339522} $\times 10^{-1}$ & \num{19} & \num{3} & \num{32} & \num{0.7812460045972} $\times 10^{-28}$ \\
\num{10} & \num{1} & \num{3} & \num{0.7887628927052} $\times 10^{-2}$ & \num{20} & \num{4} & \num{32} & \num{-0.3073219990366} $\times 10^{-30}$ \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

结果

我怎样才能做到这一点:

  • 列 n_i 中的第一个零彼此对齐
  • 列 n_i 中的所有\times(X) 都彼此对齐
  • 尾部零不会被省略\num{}

同时?我怀疑使用 align 的 & 符号是可能的&,但是表格可能会变得很大,而且我不知道如何最有效地做到这一点。

答案1

该软件包siunitx通过列说明符支持带有数字的列S

\documentclass{report}

\usepackage{caption}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}
\centering
\caption{Koeffizienten und Exponenten}
\label{tab_koeff_T_ps}
\begin{tabular}{
  S[table-format=2.0]
  S[table-format=1.0]
  S[table-format=2.0]
  S[table-format=1.13,
    table-figures-exponent=2,
    table-sign-mantissa,
    table-sign-exponent]
  S[table-format=2.0]
  S[table-format=1.0]
  S[table-format=2.0]
  S[table-format=1.13,
    table-figures-exponent=2,
    table-sign-mantissa,
    table-sign-exponent]}
\toprule
\multicolumn{1}{c}{$i$}
& \multicolumn{1}{c}{$I_i$}
& \multicolumn{1}{c}{$J_i$}
& \multicolumn{1}{c}{$n_i$}
& \multicolumn{1}{c}{$i$}
& \multicolumn{1}{c}{$I_i$}
& \multicolumn{1}{c}{$J_i$}
& \multicolumn{1}{c}{$n_i$}\\
\midrule
 1 & 0 &  0 &  0.1747826805830e3   & 11 & 1 & 12 &  0.3567211060736e-9  \\
 2 & 0 &  1 &  0.3480693089287e2   & 12 & 1 & 31 &  0.1733249699489e-23 \\
 3 & 0 &  2 &  0.6529258497845e10  & 13 & 2 &  0 &  0.5660890065483e-3  \\
 4 & 0 &  3 &  0.33039981775489    & 14 & 2 &  1 & -0.3263548313971e-3  \\
 5 & 0 & 11 & -0.1928138292319e-6  & 15 & 2 &  2 &  0.4477828669063e-4  \\
 6 & 0 & 31 & -0.2490919724457e-22 & 16 & 2 &  9 & -0.5132215690850e-9  \\
 7 & 1 &  0 & -0.26107636489332    & 17 & 2 & 31 & -0.4252265704220e-25 \\
 8 & 1 &  1 &  0.22592965981586    & 18 & 3 & 10 &  0.2640044136068e-12 \\
 9 & 1 &  2 & -0.6425646339522e-1  & 19 & 3 & 32 &  0.7812460045972e-28 \\
10 & 1 &  3 &  0.7887628927052e-2  & 20 & 4 & 32 & -0.3073219990366e-30 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

结果

相关内容