3

I am using the siunitx package and the documentation is a bit mind-blowing.

I'm using it with no options and no sisetup.

There is zero spacing my units. I have tried to add sisetup with inter-unit-product = \, but there is no change. I believe this is meant to be the default anyway.

Here is an example.

Example of badly spaced units

For example, I use \unit{\J \kg^{-1} \K^{-1}} to typeset the corresponding unit.

Any help in getting some spacing between these units is welcome. Thanks.

2
  • You can't go wrong with \unit{\joule\per\kilogram\per\kelvin}.
    – Mico
    Jul 16, 2023 at 5:19
  • It seems both \unit{\J . \kg^{-1} . \K^{-1}} and \unit{\J \per\kg \per\K} inserts (value of) inter-unit-product between units. Jul 16, 2023 at 5:24

1 Answer 1

4

The package has two ways of reading units. First, you can give all units as commands:

\unit\unit{\J\per\kg\per\K}

This is parsed, and is used to construct the output with controllable formatting. Second, you can use 'literal' mode, where things are given by yu and typeset 'as is', e.g.

\unit\unit{J.kg^{-1}.K^{-1}}

In this mode, inter-unit spaces are indicated by . or ~.

You have mixed the two, using unit macros but some literal formatting. That forces the literal mode, but as you have no inter-unit spaces indicated, you get none. Either add . between units

\unit\unit{\J.\kg^{-1}.\K^{-1}}

or swtich to full macro-based units.

3
  • I have plans for a 'free text' mode,but that would still not work for the origianl input. 'Free text' wold be more J per kg per K/joule per kilogram per kelvin.
    – Joseph Wright
    Jul 16, 2023 at 5:18
  • Thank you @JosephWright. This worked. Can I ask you a question somewhat unrelated? Is the siunitx package documentation complete? I see everywhere people use a macro SI{}{} for numbers and units, but I haven't seen this mentioned in the docs and a search doesn't find it. Is the stuff on literal and parsing differences in there too? Jul 16, 2023 at 5:25
  • @LostInHilbertSpace Docs do mention \SI but only briefly: it was the v1/v2 interface, but I changed it for v3. For the vast majority of cases it works the same as \qty. The literal and parsed units are also covered.
    – Joseph Wright
    Jul 16, 2023 at 5:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .