5

I am getting incorrect uncertainties displayed for integer-valued numbers using the siunitx package. It seems to insert one decimal place and divide the uncertainty I specify by 10.

This is a new problem since upgrading to the 2014-09-29 package version.

enter image description here

\documentclass{article}

\usepackage{siunitx} 
\sisetup{separate-uncertainty = true} % use +/- symbol for uncertainty values

\begin{document}

Using integers, 

\verb+\num{30 \pm 2}+ gives \num{30 \pm 2}

but I want the value to appear as \num{30} 

and the uncertainty should be \num{\pm 2} with no decimal parts.

Same problem happens using \verb+\SI+ and in tables using S-columns.

Things seem to work fine if the base value is not an integer:

\verb+\num{30.5 \pm 2}+ gives \num{30.5 \pm 2}

\end{document}
  • This seems like a bug in siunitx; with the version in TeX Live 2013 I get “30 ± 2”. – egreg Oct 2 '14 at 20:20
  • 1
    In such cases the best is to inform the author @JosephWright. – Ulrike Fischer Oct 3 '14 at 12:25
  • 1
    This will be fixed in the next release of the package – Joseph Wright Oct 7 '14 at 14:39
  • This bug seems similar to a bug I have just posted about here tex.stackexchange.com/questions/446074/… – Ross Aug 14 '18 at 22:00
3

Try it with:

\num{30(2)}

This works for me, if I only change the uncertainty in the \num command.

  • That works! Now, any tips on how to replace dozens of instances of \pm x with (x)? – Scott Oct 2 '14 at 18:24
  • Unfortunately, not. Maybe with any kind of script? But I am really not into this. – Niklas Oct 2 '14 at 18:26
  • Thanks anyway for the answer. At least I can get the output I need. – Scott Oct 2 '14 at 18:30
  • 1
    I figured out how to use regexp in TeXworks' replace function: Put ([0-9\.]*) \\pm ([0-9\.]*) in the Replace: field and \1(\2) in the With: field, and run the magic with Replace or Replace All. – Scott Oct 2 '14 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.