Math & Sciencesiunitx | Typesetting Uncertainties

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

siunitx | Typesetting Uncertainties

Post by svend_tveskaeg »

Hi all.

Consider the following MWE:

Code: Select all

\documentclass{article}
\usepackage{mathtools}

\newcommand{\cm}{\,\textup{cm}}

\begin{document}

\begin{align}
  O &= 8 \cdot (50 \pm 0{,}5)\cm = (400 \pm 4{,}0)\cm,\\
  h &= (3 \cdot 178 + 6 \pm 10)\cm = (540 \pm 10)\cm.
\end{align}

\end{document}
How do I produce the same output using the sinuitx package? I have looked at page 45 in the documentation, but I cannot figure out how to do it.

Thank you in advance!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

siunitx | Typesetting Uncertainties

Post by localghost »

You should strongly learn how to read manuals.

Code: Select all

\documentclass[11pt]{article}
\usepackage{mathtools}
\usepackage{siunitx}

\sisetup{
  separate-uncertainty=true
}

\begin{document}
  \begin{align}
    O &= 8 \cdot \SI{50,0(5)}{\cm} = \SI{400(4)}{\cm},\\
    h &= 3 \cdot \SI{178}{\cm} + \SI{6(10)}{\cm}= \SI{540(10)}{\cm}
  \end{align}
\end{document}

Thorsten
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

siunitx | Typesetting Uncertainties

Post by svend_tveskaeg »

Thank you.

I thought that I it was possible to typeset the last equation using a single \SI.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

siunitx | Typesetting Uncertainties

Post by localghost »

svend_tveskaeg wrote:[…] I thought that I it was possible to typeset the last equation using a single \SI.
The way you tried to typeset this expression makes no sense.
Post Reply