# siunitx table: column with and without units

I have a table listing several properties. Some of them have a unit some don't. All have a uncertainty. Now I want to align them properly in the table using the siunitx package. See following MWE:

\documentclass{article}
\usepackage{siunitx}

\sisetup{separate-uncertainty}
\sisetup{multi-part-units=single}

\begin{document}

\begin{tabular}[b]{|l|S|}
\hline
Property    & {Value} \\\hline
A           & \SI{284.98 \pm 5.2}{\meter} \\\hline
B           & \SI{3.86 \pm 0.3}{\kilo\gram} \\\hline
C           & \num{96.4 \pm 42.3} \\\hline
\end{tabular}

\end{document}


The problem is, that none of the values are aligned correctly.

Update: The result should like the following:

A    284.98 +/-  5.2 m
B      3.86 +/-  0.3 kg
C     96.4  +/- 42.3


However, the alignment of the uncertainty is not necessarily required.

• What's the desired alignment? – Troy Dec 22 '17 at 9:24

\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\sisetup{separate-uncertainty}
\sisetup{multi-part-units=single}

\begin{document}
\begin{tabular}{
l
S[table-format=3.2]@{\,$$\pm$$\,}
S[table-format=2.1]@{\,}
s[table-unit-alignment = left]
}
\toprule
Property    &\multicolumn{3}{c}{Value}  \\
\midrule
A           & 284.98 & 5.2 & \si{\meter} \\
B           & 3.86 & 0.3 & \si{\kilo\gram}  \\
C           & 96.4 & 42.3  \\
\bottomrule
\end{tabular}
\end{document}


In this MWE, I have separated the number and the uncertainty into two columns that are automatically separated by the +- sign. With table-format=3.2 I can make sure, that the numbers are aligned correctly with respect to the decimal separator. The units are in a third column and left-aligned. Additionally, I have removed all vertical lines and have replaced \hrules by the lines of the booktabs package.

• You could keep the uncertainties in the same column as the values and use separate-uncertainty – Joseph Wright Dec 22 '17 at 9:56
• @JosephWright I tried this as well, but was unfortunately not able to set up the table-format of this column option correctly. – leandriis Dec 22 '17 at 10:15