# Proper way to typeset units such as N/m when using different body text and math font

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}

• is there a particular reason to use cm math with times text they famously look horrible together: Times makes cm math look horribly thin. – David Carlisle Jul 8 '18 at 20:56
• University requirement, well rather that is how my university template is set up. – Brunet Jul 8 '18 at 20:59
• well you need to hand in whatever you need to hand in, but I wouldn't worry about typographic niceties of spacing in that version, for use other than the copy you have to submit I would use cm for text and math or a times clone (eg \usepackage{newtxtext,newtxmath}) for both, not a mixture. – David Carlisle Jul 8 '18 at 21:17
• I think it is nicer to use \si{\newton\per\metre} in the document and \sisetup{per-mode=symbol}. This way you can later easily change the per-mode for the entire document and stay homogeneous (if necessary). – Skillmon Jul 8 '18 at 21:24
• Are you sure the university requires the mix and that the failure to change the maths font to something matching isn't just poor design on the part of the template's author? Assuming that you could submit Word, it seems very unlikely cm is required for maths. – cfr Jul 9 '18 at 0:49

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.

\si[detect-all]{N/m} is the same as N/m.


The power of the package becomes more evident when you use complex units, which quickly become awkward to typeset correctly.

\si[detect-all]{N/m^2} versus N/m$^2$. % The second ^2 uses math font instead of text font.


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:

\si{N/m} versus $\si{N/m}$. % Always use math font \\
\sisetup{detect-all}
\si{N/m} versus $\si{N/m}$. % Adapts to math or text font


You can also use unit macro input, which gives you more flexibility because you can use global options to affect unit typesetting.

\sisetup{per-mode = reciprocal} % default setting
\si{N/m} versus \si{\newton\per\meter}\\
\sisetup{per-mode = symbol}
\si{N/m} versus \si{\newton\per\meter}


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,

\SI{5}{N/m}\\
5 \si{N/m}


and \SIrange and \SIlist that automatically format ranges and lists automatically:

\SIrange{0}{5}{N/m}\\
\SIlist{0;1;2;3;4;5}{N/m}