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
Am 09.10.2012 um 21:04 schrieb Romain Diss
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.
Can you explain which numbers this should represent: \m{12\,345,567\,89}~kg \m{345,567\,89}~kg Wolfgang
Am 09.10.2012 um 22:01 schrieb Wolfgang Schuster
Am 09.10.2012 um 21:04 schrieb Romain Diss
: 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.
Can you explain which numbers this should represent:
\m{12\,345,567\,89}~kg \m{345,567\,89}~kg
For get about this but you can try what happens when you don’t add a separator between the number groups in the decimal parts. Wolfgang
Am 09.10.2012 um 22:11 schrieb Marco Patzer
2012-10-09 Wolfgang Schuster:
Can you explain which numbers this should represent:
\m{12\,345,567\,89}~kg
12345.56789 kg
\m{345,567\,89}~kg
345.56789 kg
Thanks but I realized it myself (I guess I need sleep), The problem is that Hans number parser doesn’t check for a separator in the decimal numbers. Wolfgang
2012-10-09 Wolfgang Schuster:
The problem is that Hans number parser doesn’t check for a separator in the decimal numbers.
If the unit code is being touched maybe you can address this one as well: http://article.gmane.org/gmane.comp.tex.context/78251 Marco
Le mardi 09 octobre 2012, Wolfgang Schuster a écrit :
Am 09.10.2012 um 22:11 schrieb Marco Patzer
: 2012-10-09 Wolfgang Schuster:
Can you explain which numbers this should represent:
\m{12\,345,567\,89}~kg
12345.56789 kg
\m{345,567\,89}~kg
345.56789 kg
Thanks but I realized it myself (I guess I need sleep), The problem is that Hans number parser doesn’t check for a separator in the decimal numbers. Thanks for the response.
The minimal example was suppose to test three numbers: one with a separator in
the integer part (12345.567), one with a separator in the decimal part
(345.56789) and one in both (12345.56789).
Anyway, if one forget the problem of the separator in the decimal part which
is not handle, none of the 'method=', 'order=' and 'language=' combinations in
\setupunit make it possible to render a number in the french format (a comma
as the decimal separator and a thin space for the "three digits" separator).
Any idea to get this work?
--
Romain Diss
Hi Romain, If inputting in the English format is an option, this works: \setupunit[method=3] % comma as decimal mark, thin space for digits seperator \units{12,345.00} %--> 12 345,00 The problem is that inputting in the French format does not work: there seems to be a bug when order=reverse. % doesn't work, of course: unexpected digits seperator after decimal mark (.) \setupunit[method=3, order=normal] \units{12.345,00} % doesn't work correctly: comma is accepted as decimal mark at parse time, % but then printed as thin space anyway. ?!? \setupunit[method=3, order=reverse] \units{12.345,00} %--> 12,345 00 I hope this helps you a bit. Kind regards, Sietse
Hi, Thanks for the response.
If inputting in the English format is an option, this works: \setupunit[method=3] % comma as decimal mark, thin space for digits seperator \units{12,345.00} %--> 12 345,00 Yes, I confirm it works (with \unit{12,345.00}). I'd prefer inputting in french but this should do the job.
% doesn't work correctly: comma is accepted as decimal mark at parse time, % but then printed as thin space anyway. ?!? \setupunit[method=3, order=reverse] \units{12.345,00} %--> 12,345 00 This one should give what I need. Can someone confirm there is a bug here and if so, is it possible to fix it?
Thanks in advance.
--
Romain Diss
Am 10.10.2012 um 21:25 schrieb Romain Diss
Hi,
Thanks for the response.
If inputting in the English format is an option, this works: \setupunit[method=3] % comma as decimal mark, thin space for digits seperator \units{12,345.00} %--> 12 345,00 Yes, I confirm it works (with \unit{12,345.00}). I'd prefer inputting in french but this should do the job.
% doesn't work correctly: comma is accepted as decimal mark at parse time, % but then printed as thin space anyway. ?!? \setupunit[method=3, order=reverse] \units{12.345,00} %--> 12,345 00 This one should give what I need. Can someone confirm there is a bug here and if so, is it possible to fix it?
It is a bug and I know what’s wrong in the code but you have to wait till next week when Hans is back from the conference. I going to send then a mail to Hans with a description of this bug and also the one in Marcos link, both are in the Lua part of the code and it’s no so easy for me to fix them. Wolfgang
Sietse wrote:
% doesn't work correctly: comma is accepted as decimal mark at parse time, % but then printed as thin space anyway. ?!? \setupunit[method=3, order=reverse] \units{12.345,00} %--> 12,345 00
Wolfgang wrote:
I going to send then a mail to Hans with a description of this bug and also the one in Marcos link, both are in the Lua part of the code and it’s no so easy for me to fix them.
Actually, this bug is in the ConTeXt part of the code, in phys-dim.lua: -\unexpanded\def\digitsfinalcomma {\digitscommasymbol } % more for tracing \unexpanded\def\digitsfinalperiod {\digitsperiodsymbol} % more for tracing \unexpanded\def\digitsintermediatecomma {\digitscommasymbol } % more for tracing -\unexpanded\def\digitsintermediateperiod {\digitsperiodsymbol} % more for tracing +\unexpanded\def\digitsfinalcomma {\digitsperiodsymbol } % more for tracing \unexpanded\def\digitsfinalperiod {\digitsperiodsymbol} % more for tracing \unexpanded\def\digitsintermediatecomma {\digitscommasymbol } % more for tracing +\unexpanded\def\digitsintermediateperiod {\digitscommasymbol} % more for tracing The mistake probably arose because \digitscommasymbol always corresponds to the intermediate mark (the digits separator), not always to the comma. I know the name wrong-footed me when I was reading the code. Romain: you can make this change in phys-dim.lua (around line 220), then remake the formats with context --make cont-en Then this should work correctly: % 3: decimal comma, digits space % 4: decimal point, digits space % English input (order=normal) \setupunits[method=3] \unit{11,122.13 micro mol per second} \par \setupunits[method=4] \unit{21,222.23 micro mol per second} \par % French input (order=reverse) \setupunits[method=3, order=reverse] \unit{31.322,33 micro mol per second} \par \setupunits[method=4, order=reverse] \unit{41.422,43 micro mol per second} \par Cheers, Sietse
participants (4)
-
Marco Patzer
-
Romain Diss
-
Sietse Brouwer
-
Wolfgang Schuster