2

I am relatively new to Latex and did not find an answer to the following problem: I am writing a thesis using the book class. The text contains many numbers including their plus/minus uncertainties. I normally type them as following:

Example 1: $-1.123 \pm 0.123$
Example2: $(1.2 \pm 0.1) \times \num{e-2}$

However, the space in between the plus/minus sign and the numbers left and right changes, depending on where in the text it appears. Sometimes it is without any space and sometimes there is quite some space. What am I doing wrong? From scientific articles I know that this should be consistent throughout the whole text?

I know, in the first example I could write: -1.123 $\pm$ 0.123. In that case the space will be added each time, but the minus sign looks ugly then. Any advice? Thanks for your help!

  • 2
    Welcome to TeX.SX! Could you provide a short minimal working example (MWE) showing the described behavior? It should start with \documentclass, contain all the packages necessary to reproduce the effect, and end with \end{document}. This helps us to help you. – nox Jul 31 '18 at 19:37
  • what is \num supposed to do? It's not defined in any standard class. My guess is that whatever defined that for you also changed the spacing of \pm.... As above, if you want help here, please give us a complete-but-minimal example that we can compile, so that we can see the problem. – Thruston Jul 31 '18 at 20:47
1

Use siunitx:

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\sisetup{separate-uncertainty}

\begin{document}

\num{-1.123 \pm 0.123}

\num{1.2 \pm 0.1 e-2}

\end{document}

enter image description here

The parentheses are mandatory.

With this code we see that the spaces are not expanded:

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\sisetup{separate-uncertainty}

\begin{document}

\num{-1.123 \pm 0.123} abc

\leavevmode\hbox spread 20pt{\num{-1.123 \pm 0.123} abc}

\num{1.2 \pm 0.1 e-2} abc

\leavevmode\hbox spread 20pt{\num{1.2 \pm 0.1 e-2} abc}

\end{document}

enter image description here

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.