![](https://secure.gravatar.com/avatar/57c17c28c61c03706efc4a9112fad09b.jpg?s=120&d=mm&r=g)
Hi! I'm wondering if there's a way to have automatic thousands separation in the \unit command? \spaceddigits does that, but it doesn't work inside \unit. And using both would be quite verbose to write. Example: \starttext %% no thousands separation \unit{123456789 volt} %% manual thousands separation works \unit{123,456,789 volt} %% automatic thousands separation, but not using \unit \let\spaceddigitsseparator, \spaceddigits{123456789}\,V %% fails, no output \unit{\spaceddigits{123456789} volt} \stoptext Marco
![](https://secure.gravatar.com/avatar/5faea8b4fa0adb143383811dc94f0d22.jpg?s=120&d=mm&r=g)
Hi Marco, Can this give what you wish? \define[2]\myunit{\spaceddigits{#1}\unit{#2}} \starttext \myunit{123456789}{volt} \stoptext
On 31 Jan 2019, at 13:28, Marco Patzer
wrote: Hi!
I'm wondering if there's a way to have automatic thousands separation in the \unit command? \spaceddigits does that, but it doesn't work inside \unit. And using both would be quite verbose to write. Example:
\starttext %% no thousands separation \unit{123456789 volt}
%% manual thousands separation works \unit{123,456,789 volt}
%% automatic thousands separation, but not using \unit \let\spaceddigitsseparator, \spaceddigits{123456789}\,V
%% fails, no output \unit{\spaceddigits{123456789} volt} \stoptext
Marco ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/bc466b07cb80e46423f9911f9f629d5d.jpg?s=120&d=mm&r=g)
Maybe this should be a language specific parameter. How would you achieve a
similar result with the Indian numbering system
https://en.wikipedia.org/wiki/Indian_numbering_system , for instance?
Also, decimal and thousands separators vary from country to country. In
France, for example, they use the comma for the decimal separator, and space
for the thousand separator.
Clyde
From: ntg-context [mailto:ntg-context-bounces@ntg.nl] On Behalf Of Otared
Kavian
Sent: Thursday, January 31, 2019 2:43 PM
To: mailing list for ConTeXt users
Subject: Re: [NTG-context] Automatic thousands separation in \unit
Hi Marco,
Can this give what you wish?
\define[2]\myunit{\spaceddigits{#1}\unit{#2}}
\starttext
\myunit{123456789}{volt}
\stoptext
On 31 Jan 2019, at 13:28, Marco Patzer
![](https://secure.gravatar.com/avatar/d558f7d2c62b984d42b1e276bbdfc2c7.jpg?s=120&d=mm&r=g)
On 31 Jan 2019, at 15:00, Clyde Johnston
wrote: Maybe this should be a language specific parameter. How would you achieve a similar result with the Indian numbering system, for instance?
It is an additional feature that may or may not be linked to language. For example, in Swedish originally, the comma and stop are reversed relative English, but in modern times, a stop for decimal point might be used. To avoid confusion between commas and stops as decimal points there is an recommendation admitting both, using spaces as separators. And in India, they might prefer digit groups of two instead of three.
Also, decimal and thousands separators vary from country to country. In France, for example, they use the comma for the decimal separator, and space for the thousand separator.
![](https://secure.gravatar.com/avatar/880e9a15b17a0bf7159f4e31030a9be2.jpg?s=120&d=mm&r=g)
Am 31.01.2019 um 15:00 schrieb Clyde Johnston
: Maybe this should be a language specific parameter. How would you achieve a similar result with the Indian numbering system, for instance?
Also, decimal and thousands separators vary from country to country. In France, for example, they use the comma for the decimal separator, and space for the thousand separator.
Clyde
Shouldn’t \spaceddigits use the separator as defined by \setdigitmode and \setdigitorder? Axel
![](https://secure.gravatar.com/avatar/57c17c28c61c03706efc4a9112fad09b.jpg?s=120&d=mm&r=g)
On Thu, 31 Jan 2019 13:43:13 +0100
Otared Kavian
Can this give what you wish?
\define[2]\myunit{\spaceddigits{#1}\unit{#2}} \starttext \myunit{123456789}{volt} \stoptext
That's a way to solve it, yes. But I'd prefer it to be integrated into the \unit command. It looks cleaner and I don't have to modify the sources to use a different command. Is there a way to hook the \spaceddigits into \unit somehow? Marco
participants (5)
-
Axel Kielhorn
-
Clyde Johnston
-
Hans Åberg
-
Marco Patzer
-
Otared Kavian