How to use siunitx with non numerical values?
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 that siunitx
knows, but that will not always print in math mode. So I'd prefer the approach of turning off the number parser:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\SI[parse-numbers = false]{R}{\metre\per\second}
\end{document}
As egreg points out, to get italic output you'll need to set the math-rm
option
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\SI[number-math-rm = \mathnormal, parse-numbers = false]{R}{\metre\per\second}
\end{document}
Turning 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).
I think you are raising two questions: First, how to set the spacing between the "R" and its unit (m/s) and second, whether to typeset the "R" in upright or italic shape.
Regarding the former: I believe what siunitx
does in the \SI
macro is to insert a thinspace
width between the quantity and its unit; one can generate this spacing manually with the \,
command. Regarding the latter question: I believe it is (near-)universal practice to typeset variables in italic shape. Hence, I'd recommend you use the following command:
$R$\,\si{meter\per\second}
\NewDocumentCommand{\varSI}{O{}}{\SI[math-rm=\mathnormal,parse-numbers=false,#1]}
\varSI{R}{\meter\per\second}
\varSI[math-rm=\mathbf]{R}{\meter\per\second}