I understand that something like \SI{5}{\meter\per\second}
defines a certain space between the number (5) and units (m/s). What should I use if instead of a numerical quantity I want a variable: R m/s? \SI{R}{\meter\per\second}
fails because it expect a number in first parameter, and R \si{\meter\per\second}
or $R$ \si{\meter\per\second}
show different space.
Which is the correct use?
\documentclass{standalone}
\usepackage{siunitx}
\sisetup{per-mode=symbol}
\begin{document}
\begin{tabular}{r}
\SI{5}{\meter\per\second}\\
$R$ \si{\meter\per\second}\\
R \si{\meter\per\second}\\
\end{tabular}
\end{document}
Best Answer
As others have commented, this is partly a style question. In terms of non-numerical input, you've got a couple of choices. You could add
R
as a 'symbol' to those thatsiunitx
knows, but that will not always print in math mode. So I'd prefer the approach of turning off the number parser:As egreg points out, to get italic output you'll need to set the
math-rm
optionTurning off the parser forces math mode, but retains font control and also consistent spacing (so if you alter the setting for
number-unit-separator
it will be updated).