2

I am trying to typeset a table with data values and their uncertainties using LaTeX with the siunitx package. Some data values within a given column are much larger than 1, and others are much smaller than 1. The siunitx package first aligns the numbers at their decimal point, and then aligns the data at the "+/-" sign used for the uncertainty.

This two-step alignment is not desired in my situation. I need the data aligned at the "+/-" sign only.

How can I achieve this?

Here is a MWE to illustrate the problem:

\documentclass[12pt]{article}
\usepackage{booktabs}
\usepackage{siunitx}

\sisetup{separate-uncertainty=true , table-align-uncertainty=true }

\begin{document}

\begin{table}
\centering
\begin{tabular}{ l S[table-format=3.7(2)] }
\toprule
{Column 2}  & {Column 2} \\
Hello       & 124(5) \\
World       & 0.0005678(9) \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

enter image description here

1 Answer 1

-1

enter image description here

\documentclass[12pt]{article}
\usepackage{booktabs}
\usepackage{siunitx,etoolbox}

\sisetup{separate-uncertainty=true , table-align-uncertainty=true }

\begin{document}

\begin{table}
\centering
\begin{tabular}{ l S[table-format=3.7,detect-weight,mode=text] @{${}\pm{}$}
S[table-format=1.7,detect-weight,mode=text] }
\toprule
{Column 2}  &\multicolumn{2}{c}{Column 2} \\
{Hello}       & 124.0000000 & 5 \\
{World }      & 0.0005678 & 0.0000009 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}
3
  • Please be aware that this will drastically change the number of significant figures of the entry in the first row.
    – leandriis
    Apr 6, 2020 at 9:26
  • 2
    If you want to split up the value and its uncertainty into two columns, you could simply use r @{${}\pm{}$} l instead of the two S type columns.
    – leandriis
    Apr 6, 2020 at 9:33
  • Well, I could certainly achieve the right output by manually splitting the value and its uncertainty into two columns. However, that's far from elegant and certainly not convenient. There must be a better way by using the magic of siunitx.
    – mbrennwa
    Apr 6, 2020 at 13:48

You must log in to answer this question.

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