Can the space between the value and the unit be added automatically, when units are written using the SIunits
package?
The package gives the following two options to add units:
$500\kelvin$
$\unit{500}{\kelvin}$
Only the latter adds seperation between value and unit. Adding the \unit{...}{...}
parameter is too cumbersome and doesn't give any ease of use compared to the manual \;\mathrm{...}
method.
Using the former notation to avoid this, the space can be added manually with \;
of course, 500\;\kelvin
, but I am now looking for the possibility of never having to add anything but the unit.
I have looked into the siunitx
package as well, which only replaces the \unit{...}{...}
with \SI{...}{...}
(and apparently makes it mandatory!). This therefore gives no help.
Is it possible to automatically/generally add a \;
before every single unit (and unit group) in the document?
Best Answer
One could achieve this in
SIunits
by patching an appropriate internalYou can also do this in
siunitx
by activating 'free standing' units and 'pre-spacing'(Using
\qty
is recommended as there are outcomes that require a more structured mark-up, but one design aim has always been to support a range of input forms.)For these approaches to work you have to have the unit as a single command: chaining things together such as
\volt\per\kelvin
won't work as there is no way to 'know' what marks the end of the unit. Forsiunitx
we can declare a new unit which will then only add a space at the start(The need to define units 'up front' for 'pre-spacing' to work is one reason the
siunitx
documentation is primarily focussed on logic mark up.)This is much harder to achieve with
SIunits
as the unit commands are not context-sensitive. One might add appropriate switching but this becomes a significant change in the way the code works: probably crosses into 'development' (which as theSIunits
documentation says is now done insiunitx
.)