I'm using siunitx to report a value plus an 'uncertainty' (as defined in the siunitx package). I'm running into problems with my desired formatting, and I think the issue is because I'd like the resulting uncertainty to have a different number of decimal places than the value that the uncertainty pertains to. E.g. 98.5 (one decimal place) +/- 0.98 (two decimal places). Note that in this example the values have a unit (%) meaning that solutions using \SI
are preferred over num
.
Anyone know how to produce something equal to the first attempt below but with the first number (98.5) reported to one decimal place instead of 2?
The context is that I am citing values from a scientific journal article, so regardless of whether a differing number of decimal places is 'correct' I want to accurately reflect the values reported. The 'uncertainty' in this context represents standard deviation about a mean.
Below is an MWE:
\documentclass{article}
\usepackage{textcomp}
\usepackage{siunitx}
\sisetup{range-units=single,
separate-uncertainty = true,
multi-part-units = single}
\begin{document}
\noindent\SI{98.5 \pm 0.98}{\percent} : Spacing correct, precision wrong (desired 98.5, not 98.50)
\noindent\SIrange[range-phrase=\ \textpm\ ]{98.50}{0.98}{\percent} : Workaround. Note different (wrong) spacing around plus/minus sign
\noindent\ \SIrange[range-phrase=\ \textpm\ ]{98.5}{0.98}{\percent} : Workaround with desired numbers. Incorrect spacing maintained
\noindent\SI{98.5 (98)}{\percent} : Precision correct, uncertainty value wrong.
%\noindent\SI{98.5 (9.8)}{\percent} : Expected to fix uncertainty value of above, returns error instead
\end{document}
Best Answer
There are limits to what one can convince the parsing system to do: where that happens, you'll need to do things manually. Depending on how you want your markup to look, you might go with
or