[NTG-context] Spacing in \unit

Gavin gavinpublic at comcast.net
Sun Sep 25 15:30:30 CEST 2022

Hello list,

I have a few questions about space produced by the unit command. Consider this MWE

\unit{3.00e8 kg m/s}

$\unit{3.00e8 kg m/s}$

The dot between “kg” and “m” has different spacing depending on whether the \unit command is in text or math mode. I think that the tighter spacing in the first one, in text, is correct.

I personally would also like less space around the \times. To me, the number 3.00e8 should be typeset more like a single number, rather than like a product of 3.00 and 10^8. I am probably in the minority here. If \unit and \digit had an option for tighter spacing around the \times, I’d use it, but the current output with more space is probably what most people expect and want. Perhaps something like [scispace=tight].

Finally, \unit does not play nicely with surrounding spaces. For example:

    $2\pi\,\unit{3.00e8 kg m/s}$

causes a fatal error:

tex error       > tex error on line 9 in file ./Untitled.tex: Incompatible glue units (case 1)

<macro> \phys_units_direct 
    #1->\begingroup \the \everyunits \ifdim \lastskip 
    >\zeropoint \settrue \c_phys_units_dospace \removelastskip \fi \c_phys_digits_method \unitparameter \c!method \relax \ifmmode \else \dontleavehmode \fi \edef \currentunit {#1}\always\edef \unitlanguag
<line 3.9> 
    {3.00e8 kg m/s}$

Using \thinspace produces the same fatal error.

Putting the 2\pi after the \unit{…} can also cause surprises.

    $\unit{3.00e8 kg m/s}\times 2\pi$

produces a \times that is right up against the “s”.

I am very happy with all of the work done on spacing in math. I hope that my observations above are helpful in fine-tuning the excellent system.


P.S. I am on as M1 Mac, using ConTeXt  ver: 2022.09.11 20:44 LMTX  fmt: 2022.9.25  int: english/english.

More information about the ntg-context mailing list