ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Romain Diss <romain.diss@yahoo.fr>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: \unit and french
Date: Tue, 9 Oct 2012 21:04:00 +0200	[thread overview]
Message-ID: <201210092104.01118.romain.diss@yahoo.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

Hi all,

As you know, the french number format is almost opposite to the english one: 
period and comma have opposite roles.

My question concerns the way to render properly numbers in french with the 
\unit command. I already tried different combinations of 
\setupunit[method=,order=] but I can’t find the right way. I tried even to 
type french or english format as input for \unit but none output is right 
(actually I'd prefer to type french format as \unit input).
Also, when there are "three digits" separators on both sides of the decimal 
point, some method outputs are not consistent.

I attached a not so minimal exemple.

Thanks for any idea to solve this.


-- 
Romain Diss
<romain.diss@yahoo.fr>

[-- Attachment #2: test-unit-02.tex --]
[-- Type: text/x-tex, Size: 3004 bytes --]

\starttext

\startbuffer
\starttabulate[|l|l|l|]
\HL
\NC  \NC \tex{unit} input: french format \NC \NR
\HL
\NC method 0 \NC \setupunits[method=0]\unit{12.345,567 kilogram} --- \unit{12.345,567.89 kilogram} --- \unit{345,567.89 kilogram} \NC \NR
\NC method 1 \NC \setupunits[method=1]\unit{12.345,567 kilogram} --- \unit{12.345,567.89 kilogram} --- \unit{345,567.89 kilogram} \NC \NR
\NC method 2 \NC \setupunits[method=2]\unit{12.345,567 kilogram} --- \unit{12.345,567.89 kilogram} --- \unit{345,567.89 kilogram} \NC \NR
\NC method 3 \NC \setupunits[method=3]\unit{12.345,567 kilogram} --- \unit{12.345,567.89 kilogram} --- \unit{345,567.89 kilogram} \NC \NR
\NC method 4 \NC \setupunits[method=4]\unit{12.345,567 kilogram} --- \unit{12.345,567.89 kilogram} --- \unit{345,567.89 kilogram} \NC \NR
\NC method 5 \NC \setupunits[method=5]\unit{12.345,567 kilogram} --- \unit{12.345,567.89 kilogram} --- \unit{345,567.89 kilogram} \NC \NR
\NC method 6 \NC \setupunits[method=6]\unit{12.345,567 kilogram} --- \unit{12.345,567.89 kilogram} --- \unit{345,567.89 kilogram} \NC \NR
\HL
\stoptabulate

\starttabulate[|l|l|l|]
\HL
\NC  \NC \tex{unit} input: english format \NC \NR
\HL
\NC method 0 \NC \setupunits[method=0]\unit{12,345.567 kilogram} --- \unit{12,345.567,89 kilogram} --- \unit{345.567,89 kilogram} \NC \NR
\NC method 1 \NC \setupunits[method=1]\unit{12,345.567 kilogram} --- \unit{12,345.567,89 kilogram} --- \unit{345.567,89 kilogram} \NC \NR
\NC method 2 \NC \setupunits[method=2]\unit{12,345.567 kilogram} --- \unit{12,345.567,89 kilogram} --- \unit{345.567,89 kilogram} \NC \NR
\NC method 3 \NC \setupunits[method=3]\unit{12,345.567 kilogram} --- \unit{12,345.567,89 kilogram} --- \unit{345.567,89 kilogram} \NC \NR
\NC method 4 \NC \setupunits[method=4]\unit{12,345.567 kilogram} --- \unit{12,345.567,89 kilogram} --- \unit{345.567,89 kilogram} \NC \NR
\NC method 5 \NC \setupunits[method=5]\unit{12,345.567 kilogram} --- \unit{12,345.567,89 kilogram} --- \unit{345.567,89 kilogram} \NC \NR
\NC method 6 \NC \setupunits[method=6]\unit{12,345.567 kilogram} --- \unit{12,345.567,89 kilogram} --- \unit{345.567,89 kilogram} \NC \NR
\HL
\stoptabulate
\stopbuffer

\language[en]
What is expected in french:

\language[fr]
\m{12\,345,567}~kg --- \m{12\,345,567\,89}~kg --- \m{345,567\,89}~kg

\language[en]
What would be expected in english:

\language[fr]
\m{12,345.567}~kg --- \m{12,345.567,89}~kg --- \m{345.567,89}~kg

\stoptabulate

\startsection[title=French language]

  \language[fr]

  \startsubsection[title=Normal order]
  
  \setupunit[order=normal]
  \getbuffer

  \stopsubsection

  \startsubsection[title=Reverse order]
  
  \setupunit[order=reverse]
  \getbuffer

  \stopsubsection

\stopsection

\startsection[title=English language]

  \language[en]

  \startsubsection[title=Normal order]
  
  \setupunit[order=normal]
  \getbuffer

  \stopsubsection

  \startsubsection[title=Reverse order]
  
  \setupunit[order=reverse]
  \getbuffer

  \stopsubsection

\stopsection


\stoptext

[-- Attachment #3: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2012-10-09 19:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 19:04 Romain Diss [this message]
2012-10-09 20:01 ` Wolfgang Schuster
2012-10-09 20:06   ` Wolfgang Schuster
2012-10-09 20:11   ` Marco Patzer
2012-10-09 20:29     ` Wolfgang Schuster
2012-10-09 20:40       ` Marco Patzer
2012-10-09 21:08       ` Romain Diss
2012-10-10 15:41         ` Sietse Brouwer
2012-10-10 19:25           ` Romain Diss
2012-10-10 19:51             ` Wolfgang Schuster
2012-10-10 20:59               ` Sietse Brouwer

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=201210092104.01118.romain.diss@yahoo.fr \
    --to=romain.diss@yahoo.fr \
    --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).