On 12/09/2025 08:45, Johannes Schauer Marin Rodrigues wrote:
Hi,

the document "The International System of Units (SI) (9th ed)" states in
chapter 5.4.3:

The numerical value always precedes the unit and a space is always used to
separate the unit from the number. Thus the value of the quantity is the
product of the number and the unit. The space between the number and the unit
is regarded as a multiplication sign (just as a space between units implies
multiplication). The only exceptions to this rule are for the unit symbols
for degree, minute and second for plane angle, °, ′ and ″, respectively, for
which no space is left between the numerical value and the unit symbol.

https://web.archive.org/web/20230113090424/https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf/

it would be nice if numfmt would support outputting formatted numbers that
conform to this requirement. Currently, no space is placed between number and
unit suffix.

I tried to come up with a patch implementing this, which you can find attached.
To preserve backwards compatibility, I introduced a new option called
--space-separated. I made this option not specific to SI-conformance because it
also works with custom suffixes and it has no special handling if the suffix
happens to be a degree symbol.

Please keep me CC-ed in replies, as I'm not subscribed to the list.

Thank you for considering!

cheers, josch

Yes I think this feature is useful. I think the standards
also mention a preference to avoid line breaks between numbers,
and so NBSP might be good to support as an option also.

So we could have an optional argument like: --suffix-space[=CHAR]

Supporting:

 --suffix-space            # ASCII space
 --suffix-space=$'\u00A0'  # Non breaking space
 --suffix-space=$'\u202F'  # Narrow NBSP

This should ideally support such suffix spacing on _input_ numbers too,
though that's more complicated, especially with --field processing
and ASCII spacing.

cheers,
Padraig

Reply via email to