Skip to content

Rounding uncertainty in tables results in different number of digits #843

@jankapte

Description

@jankapte

I love that package and it works great throughout the body of my article, but I'm having a hard time to apply it in tables:

\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{table}
  \sisetup{uncertainty-mode=separate, round-precision=1, round-mode=uncertainty, table-alignment-mode=format}
  \centering
  \caption{my caption}\label{my label}
  \begin{tblr}{
    hline{1,Z} = {1pt, solid},
    hspan=minimal,
    colspec = {@{}S[table-format=1.1(1)] S[table-format=1.1(1)] S[table-format=1.1(1)] S[table-format=1.1(1)] S[table-format=1.1(1)]@{}},
    row{1} = {font=\bfseries, guard},
    }
    3*std (\unit{\kelvin})                & max (\unit{\kelvin})                 & mean (\unit{\kelvin})                 & rms (\unit{\kelvin})                 & std (\unit{\kelvin})                 \\
    1.88385113 +- 0.27152522 & 1.86174299 +- 0.66771079 & -0.08869092 +- 0.11967722 & 0.64419944 +- 0.09334350 & 0.62795038 +- 0.09050841\\
  \end{tblr}
\end{table}

This renders as

Image

Is there any way to enforce rounding of all numbers to N (say 1) places? I think I understand that rounding the uncertainty rounds to significant digits first and then applies the same precision to the "main" number - but can we enforce something like

\begin{table}
  \sisetup{uncertainty-mode=separate, round-precision=1, round-mode=places, table-alignment-mode=format}
  \centering
  \caption{my caption}\label{my label}
  \begin{tblr}{
    hline{1,Z} = {1pt, solid},
    hspan=minimal,
    colspec = {@{}S[table-format=1.1(1)] S[table-format=1.1(1)] S[table-format=1.1(1)] S[table-format=1.1(1)] S[table-format=1.1(1)]@{}},
    row{1} = {font=\bfseries, guard},
    }
    3*std (\unit{\kelvin})                & max (\unit{\kelvin})                 & mean (\unit{\kelvin})                 & rms (\unit{\kelvin})                 & std (\unit{\kelvin})                 \\
    1.88385113 +- 0.27152522 & 1.86174299 +- 0.66771079 & -0.08869092 +- 0.11967722 & 0.64419944 +- 0.09334350 & 0.62795038 +- 0.09050841\\
  \end{tblr}
\end{table}

Note the round-mode.

This results in

Image

but I'd love to see something like this (which I created by manually rounding the numbers in the table).

Image

Are there any workarounds to achieve my goal? Maybe by splitting the numbers in to two explicit numbers and round those, a la $\num{1.8}\pm\num{0.1}$? How would that work in a table?

Note that my uncertainties are standard deviations of measurement data in reality.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions