4

I'm just starting to get to grips with the siunitx package, but I've noticed that there seems to be some issues with regards to unit notation spacing in an equation. With siunitx it is possible to put a space between the numerical value and the unit by leaving a space after the number of before the unit (e.g., \num{3.7d10} \si{\becquerel} or \num{3.7d10}\si{ \becquerel}).

However, when I do this in equation mode there doesn't seem to be a way to create a space between the number and the unit. Am I missing something, or is this an inherent fault/problem?

\documentclass[12pt,a4paper]{report}
% International language package - allows use of special characters
\usepackage[utf8]{inputenc}
% Line spacing package - allows user to set line spacing
\usepackage{amsmath}
% Graphics package - allows document to include various graphics files
\usepackage{chemformula}
% SI Unit package - allows for standard unit notation
\usepackage{siunitx}
\DeclareSIUnit\curie{Ci}

\begin{document}

% no spaces
\num{3.7d10}\si{\becquerel} \\

% space before unit
\num{3.7d10}\si{ \becquerel} \\

% space after number
\num{3.7d10} \si{\becquerel} \\

% no spaces
\begin{equation}
\num{1}\si{\becquerel} = \num{2.703d11}\si{\curie} \\
\end{equation}

% spaces before units
\begin{equation}
\num{1}\si{ \becquerel} = \num{2.703d11}\si{ \curie} \\
\end{equation}

% spaces after number
\begin{equation}
\num{1} \si{\becquerel} = \num{2.703d11} \si{\curie} \\
\end{equation}

\end{document}
0

2 Answers 2

12

When you're typesetting a numerical quantity with units, you're supposed to use the \SI macro:

\SI{3.7d10}{\becquerel}

That effectively formats the first argument using \num, the second using \si, and inserts the proper spacing between them, even when typesetting an equation (i.e. when in math mode).

Normally spaces are ignored in math mode, so that you can write e.g. 3\times 10 or 3 \times 10 and the result will be the same.

2
  • 1
    Is it possible to change the spacing between the number and unit when using \SI? Mar 26, 2021 at 15:08
  • @HélitonMartins yes, it's possible. You can do \sisetup{number-unit-product=~} to change the spacing to one non-breaking-space (~)
    – Zciurus
    Mar 28 at 10:22
5

Unless I'm missing something obvious, you can just use

\documentclass{article}

\usepackage{siunitx}

\begin{document}

\begin{equation}
  \SI{1.234}{\m\per\square\s}
\end{equation}

\end{document}

output

Another possibility (but not a recommended one) is

\documentclass{article}

\usepackage{siunitx}

\begin{document}

\begin{equation}
  \num{1.234}\,\si{\m\per\square\s}
\end{equation}

\end{document}

output

The second approach should only be used if you want alignment points at both the numbers and the units, as shown here.

0

You must log in to answer this question.

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