ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Otared Kavian <otared@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Automatic thousands separation in \unit
Date: Thu, 31 Jan 2019 13:43:13 +0100	[thread overview]
Message-ID: <F3D5B5EB-3600-4229-A07C-DCA7CBDCD7AB@gmail.com> (raw)
In-Reply-To: <20190131132800.0eb21089@homerow>


[-- Attachment #1.1: Type: text/plain, Size: 1337 bytes --]

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@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@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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 3054 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

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

  reply	other threads:[~2019-01-31 12:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 12:28 Marco Patzer
2019-01-31 12:43 ` Otared Kavian [this message]
2019-01-31 14:00   ` Clyde Johnston
2019-01-31 14:54     ` Hans Åberg
2019-02-02 10:59     ` Axel Kielhorn
2019-02-05 11:22   ` Marco Patzer
2019-02-09 20:22     ` Marco Patzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F3D5B5EB-3600-4229-A07C-DCA7CBDCD7AB@gmail.com \
    --to=otared@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).