[Tex/LaTex] Text with spaces in units using siunitx

siunitx

I used to (a month or two ago) be able to make my units with some arbitrary text, with spaces, which helped a lot since I use a lot of different units and labels in my data, and I have no need to define special cases for each and every one.

For instance,

\SI{1}{liter soln}

would produce "1 liter soln"

However I recently updated all my packages and apparently this does not work anymore. I now get all the spaces in the units removed, so "1 litersoln".

Can someone confirm that siunitx changed recently to enforce always using properly declared units in \SI{}{}? And if so, is there some easy way to work around? To be clear I DO NOT want to define unique qualifiers and units for each case because I would literally have dozens in my file, each used once.

Best Answer

Unit input in siunitx should in general not include spaces as these are not part of the unit itself. If you really want a space, make an explicit one

\documentclass{article}
\usepackage{siunitx}

\begin{document}
\si{litre\ soln}
\end{document}

(Input should as far as possible not depend on math/text mode or should force the appropriate mode.)

That said, litre is not a unit symbol and siunitx is not intended for dealing the the names of units. As such, a more typical piece of input might read

\documentclass{article}
\usepackage{siunitx}
\sisetup{qualifier-mode = space}
\begin{document}
\si{\litre\of{soln}}
\end{document}

where it is not necessary to have a separate qualifier defined for each type. (Of course, you should not actually have qualifiers in units, as the BIPM make clear!) Done in this way you can define \litre to give 'litre' if you wish.