1

I am using siunitx in order to display some "mean ± std" of some statistical results, and I use the round-mode=uncertainty option in order to keep the leading order of magnitude of the uncertainty only and match the precision of the mean.

However, if the uncertainty is bigger than the actual value, only a 0 is printed, without the ± sign or uncertainty.

Here is an example:

\documentclass{article}
\usepackage{siunitx}
\sisetup{round-mode=uncertainty,round-precision=1,uncertainty-mode=separate}

\begin{document}

\noindent
\num{10.1 +- 1.0}   \\ % Correct output
\num{0.01 +- 1}     \\ % Prints: 0, should be 0±1
\num{1 +- 10}       \\ % Prints: 0, should be 0±10

\end{document}

Here is a somewhat similar (unanswered) question.

4
  • This would be a feature request for siunitx: I guess you want some 'retain-...' setting but don't have an immediate name for it.
    – Joseph Wright
    Commented Feb 20, 2023 at 11:38
  • (I feel the current behaviour is correct, but that's because the package is intended for formatting quantities and a quantity of 1 with an uncertainty of 10 is not meaningful, and would not use the x +- y notation for a mean/s.u. combo; however, the policy is I try to implement requests provided they are in-scope and have behaviour I can document.)
    – Joseph Wright
    Commented Feb 20, 2023 at 11:40
  • I understand your point of view, however, even for physical quantities it would make sense: p.ex. the difference between the expected and measured mass of an object. Such case could lead to a mass difference (with its units) that is smaller than the measurement uncertainty.
    – Mammouth
    Commented Feb 20, 2023 at 11:43
  • Also, any notation in the form of x +- y is a way to convey the centre and dispersion of a quantity, directly associated with its underlying statistics, right?
    – Mammouth
    Commented Feb 20, 2023 at 11:50

1 Answer 1

2

On reflection, it likely would be better to leave the uncertainty showing here for consistency with direct input of e.g. 0 +- 10, then to look for an option to remove uncertainties which are larger than main value. I will address in the next issue-fix release.


The current output is by-design, but this could be adjusted by adding an option in this area. For the present, you could use

\cs_gset:Npn \__siunitx_number_round_uncertainty:nnn #1#2#3
  {  \__siunitx_number_round_uncertainty_aux:nnn {#1} {#2} {#3} }

which will bypass the test for sufficient significant digits in the main part.

8
  • Suggestions for an option name here are welcome: the code change would be trivial so easily integrated into the next release
    – Joseph Wright
    Commented Feb 20, 2023 at 12:01
  • Thanks a lot for the answer, I'll try to think of a relevant name. I might appear quite ignorant (and I am...), but where/how should I use the option you mentionned?
    – Mammouth
    Commented Feb 20, 2023 at 12:08
  • @Mammouth I meant that I could add an option that would select between the two behaviours here (treating 0+10 as simply equal to 0 or retaining the uncertainty), but at the moment you can only achieve the effect by re-defining an internal function.
    – Joseph Wright
    Commented Feb 20, 2023 at 12:09
  • For example, one way would be to call the round-mode something slightly different, e.g. standard-deviation perhaps
    – Joseph Wright
    Commented Feb 20, 2023 at 12:11
  • round-mode=standard-deviation sounds good! Also, I realised that it is not possible to use round-mode=uncertainty with the option drop-uncertainty (I thought it would only prevent the displaying of +- y after having rounded x)
    – Mammouth
    Commented Feb 20, 2023 at 12:15

You must log in to answer this question.

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