[NTG-context] Automatic thousands separation in \unit

Clyde Johnston context at couthies.com
Thu Jan 31 15:00:53 CET 2019


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 at 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 <lists at homerow.info> 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 at 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
____________________________________________________________________________
_______

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190131/2135d2e5/attachment.html>


More information about the ntg-context mailing list