1

In the following MWE involving the siunitx package, how can I align the numbers in the second (melting temperature) and third (viscosity eta) columns? I have tried S[table-format=-2.2,table-number-alignment=left] and 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}

mwe

1
  • 2
    Don't put the numbers in \num when you're using an S-type column to get alignment.
    – Skillmon
    Dec 20, 2020 at 17:15

1 Answer 1

3

As Skillmon already pointed out, there is no need to use \num inside of a S type column. Instead, you can adjust the table-format option to account for the uncertainty. table-format=-2.2(1) should work for the "temperature" column. To also align the contents of the last column, you could split it up into two columns or just place the repeated information "@ 20°C" in the column header:

enter image description here

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .