[NTG-context] Spacing issue with \digits in math mode

Gavin gavinpublic at comcast.net
Tue Oct 4 19:44:35 CEST 2022

Hi list,

I have been trying to understand the workings of the \unit command, which is producing strange spacing in math mode. In an effort to be more systematic, I began by investigating the related \digit command. \digit works well in text, but in math mode the comma separators produce unwanted space.

\digits {12,345.67} vs.\ $\digits {12,345.67}$

Below is a one page test document, derived from the code in phys-dim.mkxl.

I think a simple fix would be to treat the comma as “ord” inside a number, but I don’t know if that is easy or not. I’d also like the space removed from around the “x" in scientific notation, which might be accomplished the same way.

Thanks for all the work on spacing in math!



\showmakeup[mathglue] %\mathspacingmode=1


Digits in math mode have problems with comma separators.

10 \setdigitmode {1} \setdigitorder{0} $\digits {12,345.67e89}$
20 \setdigitmode {2} \setdigitorder{0} $\digits {12,345.67e89}$
30 \setdigitmode {3} \setdigitorder{0} $\digits {12,345.67e89}$
40 \setdigitmode {4} \setdigitorder{0} $\digits {12,345.67e89}$
50 \setdigitmode {5} \setdigitorder{0} $\digits {12,345.67e89}$
60 \setdigitmode {6} \setdigitorder{0} $\digits {12,345.67e89}$
11 \setdigitmode {1} \setdigitorder{1} $\digits {12,345.67e89}$
21 \setdigitmode {2} \setdigitorder{1} $\digits {12,345.67e89}$
31 \setdigitmode {3} \setdigitorder{1} $\digits {12,345.67e89}$
41 \setdigitmode {4} \setdigitorder{1} $\digits {12,345.67e89}$
51 \setdigitmode {5} \setdigitorder{1} $\digits {12,345.67e89}$
61 \setdigitmode {6} \setdigitorder{1} $\digits {12,345.67e89}$


This is typeset as:

\startlines \getbuffer \stoplines

In text, the \type{\digits} command works fine:
\setdigitmode {2}\setdigitorder{0}\digits{12,345.67e89}.

Suggestion: Within \type{\digits} (and probably \type{\units}) the comma could be an \quotation{ord} rather than a \quotation{pun}. This appears to be how the period is handled.

I personally think the space around the \quotation{$\times$} is excessive, especially when the number is in a formula.
 \digits {12,345.67e89} + \digits {12,345.67e89}
I would like the \quotation{$\times$} to also be an \quotation{ord} when used for scientific notation.


More information about the ntg-context mailing list