I am writing a document which uses times
for the main body text and the math font is the standard Latex math font (Computer modern). I am typing units such as N/m in a form which uses a backslash. I have read about the package siunitx
which helps to typeset units and such. When I use siunitx
without any options, it prints si{N/m}
in the Computer Modern font. But I want the letters in the times
font. So I use \sisetup{detect-all = true, detect-family = true}
.
But then when I type si{N/m}
I get the same output as just typing N/m
. I guess this is expected? I definitely want to use the backslash to write this unit, i.e. I don't want to write something like Nm^{-1}
. Am I doing it right? I assumed the \si
command would help achieve 'correct' spacing for the units and the backslash. (if there is such a thing as 'correct' spacing of units like N/m). Here is an example of the output.
My question is am I using \si
correctly?
\documentclass{article}
\usepackage{times}
\usepackage{siunitx}
\sisetup{detect-all = true, detect-family = true}
\begin{document}
\si{N/m} or N/m
\end{document}
Best Answer
Yes, you are using siunitx correctly by giving it literal input, but using unit macros will let you use more features of the package.
For simple units, as in your example, using an siunitx macro produces the same output as typing the characters in directly.
The power of the package becomes more evident when you use complex units, which quickly become awkward to typeset correctly.
Another of siunitx's strengths is that it ensures that all of your units (and numbers) are typeset consistently. As you have already discovered, you can set whether units adapt to the font around them or are always set with math font:
You can also use unit macro input, which gives you more flexibility because you can use global options to affect unit typesetting.
Sinuitx really becomes valuable when you use some other macros such as
\SI
that ensures numbers and units are properly joined by a thin, non-breaking space,and
\SIrange
and\SIlist
that automatically format ranges and lists automatically: