当数字存在不确定性时,在表格中对齐 siunitx 数字

当数字存在不确定性时,在表格中对齐 siunitx 数字

在以下涉及siunitx封装,我怎样才能对齐第二列(熔化温度)和第三列(粘度 eta)中的数字?我已尝试S[table-format=-2.2,table-number-alignment=left]S[table-format=2.2,table-number-alignment=left]

\documentclass[oneside,11pt]{book}

\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[
  expansion = false ,
  tracking = smallcaps ,
  letterspace = 40 ,
]{microtype}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{table}
  \centering
  \begin{tabular}{
l
S[table-format=-2.2,table-number-alignment=left]
S[table-format=2.2,table-number-alignment=left]
l}
    \toprule
    & {$T_m$ (\si{\celsius})} & {$\eta$ (\si{\milli\pascal})} & $\sigma$ (\si{\siemens/\centi\meter})\\
    \midrule
    A & \num{14(1)} & \num{38(1)} & \num{13} @ \SI{20}{\celsius}\\
    B & \num{-85(2)} & \num{104(4)} & \num{3.6} @ \SI{20}{\celsius}\\
    \addlinespace
    C & \num{-1.71(7)} & \num{32.2(6)} & \num{8.8} @ \SI{20}{\celsius}\\
    D & \num{-2.93(4)} & \num{50.09(90)} & \num{3.9} @ \SI{20}{\celsius}\\
    \bottomrule
  \end{tabular}
  \caption{Caption.}
\end{table}

\end{document}

姆韦

答案1

作为Skillmon 已经指出,无需在类型列\num内使用S。相反,您可以调整选项table-format以解决不确定性。table-format=-2.2(1)应该适用于“温度”列。为了对齐最后一列的内容,您可以将其分成两列,或者只将重复的信息“@ 20°C”放在列标题中:

在此处输入图片描述

\documentclass[oneside,11pt]{book}

\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[
  expansion = false ,
  tracking = smallcaps ,
  letterspace = 40 ,
]{microtype}
\usepackage{booktabs}
\usepackage{siunitx}

\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}

\begin{document}

\begin{table}
  \centering
  \begin{tabular}{
l
S[table-format=-2.2(1),table-number-alignment=left]
S[table-format=3.2(2),table-number-alignment=left]
S[table-format=2.1]@{\;}l}
    \toprule
    & {$T_m$ (\si{\celsius})} & {$\eta$ (\si{\milli\pascal})} & \multicolumn{2}{c}{$\sigma$ (\si{\siemens/\centi\meter})}\\
    \midrule
    A & 14(1)    & 38(1)     & 13  & @ \SI{20}{\celsius}\\
    B & -85(2)   & 104(4)    & 3.6 & @ \SI{20}{\celsius}\\
    \addlinespace
    C & -1.71(7) & 32.2(6)   & 8.8 & @ \SI{20}{\celsius}\\
    D & -2.93(4) & 50.09(90) & 3.9 & @ \SI{20}{\celsius}\\
    \bottomrule
  \end{tabular}
  \caption{Caption.}
\end{table}

\begin{table}
  \centering
  \begin{tabular}{
l
S[table-format=-2.2(1)]
S[table-format=3.2(2)]
S[table-format=2.1]}
    \toprule
    & {$T_m$ (\si{\celsius})} & {$\eta$ (\si{\milli\pascal})} & {\thead[t]{$\sigma$ (\si{\siemens/\centi\meter})\\ @\SI{20}{\celsius}}}\\
    \midrule
    A & 14(1)    & 38(1)     & 13 \\
    B & -85(2)   & 104(4)    & 3.6 \\
    \addlinespace
    C & -1.71(7) & 32.2(6)   & 8.8  \\
    D & -2.93(4) & 50.09(90) & 3.9 \\
    \bottomrule
  \end{tabular}
  \caption{Caption.}
\end{table}

\end{document}

相关内容