Re: [NTG-context] Automatic thousands separation in \unit

2019-02-09 Thread Marco Patzer
On Tue, 5 Feb 2019 12:22:29 +0100
Marco Patzer  wrote:

> Is there a way to hook the \spaceddigits into \unit somehow?

I tried to add \spaceddigits to the \unit command, but it didn't
work. If someone has an idea how to do that, I'd greatly appreciate.

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
___


Re: [NTG-context] Automatic thousands separation in \unit

2019-02-05 Thread Marco Patzer
On Thu, 31 Jan 2019 13:43:13 +0100
Otared Kavian  wrote:

Sorry for the late response.

> 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
___
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
___


Re: [NTG-context] Automatic thousands separation in \unit

2019-02-02 Thread Axel Kielhorn

> 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

___
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
___


Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Hans Åberg

> 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. 


___
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
___

Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Clyde Johnston
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-boun...@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  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

___

 

___
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
___

Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Otared Kavian
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
> ___

___
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
___

[NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Marco Patzer
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
___