siunitx icon indicating copy to clipboard operation
siunitx copied to clipboard

Align uncertainties at decimal point in table

Open maxnoe opened this issue 5 years ago • 4 comments

siunitx does not align the uncertainties in tables.

Consider the following minimal example:

\documentclass[margin=1pt]{standalone}


\usepackage[
  separate-uncertainty=true,
  table-align-uncertainty=true,
]{siunitx}
\usepackage{booktabs}


\begin{document}
  \begin{tabular}{S[table-format=3.1(3)]}
    \toprule
    {$x \mathbin{/} \si{\ohm}$} \\
    \midrule
    663.0 +- 12.1 \\
    670.1 +- 10.9 \\
    678.0 +-  9.1 \\
    678 +-  8 \\
    \bottomrule
  \end{tabular}


  % workaround with two columns and multicolumn
  \begin{tabular}{S[table-format=3.1] @{${}\pm{}$} S[table-format=2.1]}
    \toprule
    \multicolumn{2}{c}{$x \mathbin{/} \si{\ohm}$} \\
    \midrule
    663.0 & 12.1 \\
    670.1 & 10.9 \\
    678.0 &  9.1 \\
    678 &  8 \\
    \bottomrule
  \end{tabular}
\end{document}

table

maxnoe avatar Jan 07 '20 13:01 maxnoe

I have the same problem, but I can't use the workaround as my header is wider than the numbers.

Would it be possible to implement the feature, that you can specify a separate number for the integral and decimal part of the uncertainty? Like table-format=3.1(2.1) in this example?

HClO4 avatar Dec 04 '20 15:12 HClO4

Does anybody know another workaround? Or will there be a fix in the future?

HClO4 avatar Dec 30 '20 14:12 HClO4

This is something like an table-align-uncertainty-decimal option: doable but not currently implemented.

josephwright avatar Apr 19 '21 15:04 josephwright

This would be awesome!

jaanli avatar Sep 23 '21 18:09 jaanli

Can someone please share the fix?

fepegar avatar Dec 18 '23 14:12 fepegar

Can someone please share the fix?

It's been in the release for over a year - what version are you using?

josephwright avatar Dec 24 '23 11:12 josephwright

It's been in the release for over a year - what version are you using?

I believe you! I just think it'd be nice to share the fix for those who (like me) land on this issue after googling how to fix this. I wasn't able to extract the information from the pull request.

fepegar avatar Jan 14 '24 19:01 fepegar

@fepegar 'Update your installation'?

josephwright avatar Jan 14 '24 19:01 josephwright

Ah, I understand. I guess you mean if I run the OP's code I won't get this issue anymore. Maybe my code was different. Apologies for the misunderstanding!

fepegar avatar Jan 14 '24 19:01 fepegar