\digits get \times instead of \cdot before exponent
Hi, is it possible to change the behaviour of \digits to have \cdot as in http://www.pragma-ade.com/general/magazines/mag-0003.pdf page 2 (table at the bottom) instead of \times as shown in the latest units-mkiv-document http://www.pragma-ade.com/general/manuals/units-mkiv.pdf pages 6&7? Thanks for your advise Christian Prim Example: \unit{10.5e3 Newton} should produce "10.5\cdot 10^3 N" and not "10.5\times 10^3 N" (also tested in the latest version at http://live.contextgarden.net/)
Le lundi 20 mai 2013, Christian Prim a écrit :
is it possible to change the behaviour of \digits to have \cdot as in http://www.pragma-ade.com/general/magazines/mag-0003.pdf page 2 (table at the bottom) instead of \times as shown in the latest units-mkiv-document http://www.pragma-ade.com/general/manuals/units-mkiv.pdf pages 6&7? Seems to be hardcoded in phys-dim.mkiv for the moment: l. 173-175
\unexpanded\def\digitspower #1{\times10\phys_digits_raised{#1}}
\unexpanded\def\digitspowerplus
#1{\times10\phys_digits_raised{\digitsplus#1}}
\unexpanded\def\digitspowerminus
#1{\times10\phys_digits_raised{\digitsminus#1}}
ntextgarden.net/)
--
Romain Diss
On 5/21/2013 11:44 AM, Romain Diss wrote:
Le lundi 20 mai 2013, Christian Prim a écrit :
is it possible to change the behaviour of \digits to have \cdot as in http://www.pragma-ade.com/general/magazines/mag-0003.pdf page 2 (table at the bottom) instead of \times as shown in the latest units-mkiv-document http://www.pragma-ade.com/general/manuals/units-mkiv.pdf pages 6&7? Seems to be hardcoded in phys-dim.mkiv for the moment: l. 173-175
\unexpanded\def\digitspower #1{\times10\phys_digits_raised{#1}} \unexpanded\def\digitspowerplus #1{\times10\phys_digits_raised{\digitsplus#1}} \unexpanded\def\digitspowerminus #1{\times10\phys_digits_raised{\digitsminus#1}} ntextgarden.net/)
there are several ways we can deal with this: % \def\digitstimessymbol{\symbol[units][times]} % \definesymbol[units][times][\times] % \definesymbol[units][times][\cdots] % \definesymbol[units][times][\kern.2\emwidth\cdot\kern.2\emwidth] \def\digitstimessymbol{\times} \def\digitstimessymbol{\cdot} \def\digitstimessymbol{\kern.2\emwidth\cdot\kern.2\emwidth} \unprotect \unexpanded\def\digitspower #1{\digitstimessymbol10\phys_digits_raised{#1}} \unexpanded\def\digitspowerplus #1{\digitstimessymbol10\phys_digits_raised{\digitsplus#1}} \unexpanded\def\digitspowerminus #1{\digitstimessymbol10\phys_digits_raised{\digitsminus#1}} \protect or maybe a key/value in setuptimes .. not sure yet Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Thanks for the tip Hans,
but the kerning in
\def\digitstimessymbol{\kern.**2\emwidth\cdot\kern.2\emwidth}
should not take place in mathmode, only in textmode. Else the space is too
big. Don't know how to deal with that.
Christian
2013/5/21 Hans Hagen
On 5/21/2013 11:44 AM, Romain Diss wrote:
Le lundi 20 mai 2013, Christian Prim a écrit :
is it possible to change the behaviour of \digits to have \cdot as in http://www.pragma-ade.com/**general/magazines/mag-0003.pdfhttp://www.pragma-ade.com/general/magazines/mag-0003.pdfpage 2 (table at the bottom) instead of \times as shown in the latest units-mkiv-document http://www.pragma-ade.com/**general/manuals/units-mkiv.pdfhttp://www.pragma-ade.com/general/manuals/units-mkiv.pdfpages 6&7?
Seems to be hardcoded in phys-dim.mkiv for the moment: l. 173-175
\unexpanded\def\digitspower #1{\times10\phys_digits_**raised{#1}} \unexpanded\def\**digitspowerplus #1{\times10\phys_digits_**raised{\digitsplus#1}} \unexpanded\def\**digitspowerminus #1{\times10\phys_digits_**raised{\digitsminus#1}} ntextgarden.net/)
there are several ways we can deal with this:
% \def\digitstimessymbol{\**symbol[units][times]}
% \definesymbol[units][times][\**times] % \definesymbol[units][times][\**cdots] % \definesymbol[units][times][\**kern.2\emwidth\cdot\kern.2\**emwidth]
\def\digitstimessymbol{\times} \def\digitstimessymbol{\cdot} \def\digitstimessymbol{\kern.**2\emwidth\cdot\kern.2\emwidth}
\unprotect
\unexpanded\def\digitspower #1{\digitstimessymbol10\phys_** digits_raised{#1}} \unexpanded\def\**digitspowerplus #1{\digitstimessymbol10\phys_** digits_raised{\digitsplus#1}} \unexpanded\def\**digitspowerminus #1{\digitstimessymbol10\phys_** digits_raised{\digitsminus#1}}
\protect
or maybe a key/value in setuptimes .. not sure yet
Hans
------------------------------**------------------------------**----- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ------------------------------**------------------------------**-----
______________________________**______________________________** _______________________ 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 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/http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ______________________________**______________________________** _______________________
On 5/21/2013 5:15 PM, Christian Prim wrote:
Thanks for the tip Hans,
but the kerning in \def\digitstimessymbol{\kern.__2\emwidth\cdot\kern.2\emwidth} should not take place in mathmode, only in textmode. Else the space is too big. Don't know how to deal with that.
\def\digitstimessymbol{\mathortext{\cdot}{\kern.2\emwidth\cdot\kern.2\emwidth}} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Now it's perfect! Will this be included in the next version of context?
Christian
2013/5/21 Hans Hagen
On 5/21/2013 5:15 PM, Christian Prim wrote:
Thanks for the tip Hans,
but the kerning in \def\digitstimessymbol{\kern._**_2\emwidth\cdot\kern.2\**emwidth} should not
take place in mathmode, only in textmode. Else the space is too big. Don't know how to deal with that.
\def\digitstimessymbol{\**mathortext{\cdot}{\kern.2\** emwidth\cdot\kern.2\emwidth}}
------------------------------**------------------------------**----- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ------------------------------**------------------------------**----- ______________________________**______________________________** _______________________ 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 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/http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ______________________________**______________________________** _______________________
Hi Hans, Christian Prim wrote:
is it possible to change the behaviour of \digits to have \cdot [...] instead of \times [...]?
Hans wrote:
there are several ways we can deal with this: [...] or maybe a key/value in setuptimes .. not sure yet
We've already got \setdigitmode, \setdigitorder, and \setdigitspace; it might make sense to create a \setupdigits to consolidate these setups into one interface. Something like this: \setupdigits [mode=4, % -->\setdigitmode{4} % (decimal period, thinspace between groups) inputdecimalmark={,}, % -->\setdigitorder{0} signspace=yes, % -->\setdigitsign{1}; '+ 1.4', not '+1.4' times=\times, % or times=\cdot ] Cheers, Sietse --------------- P.s: I've been thinking I'd like to write more contexty interface that doesn't use predefined modes, but lets you setup the decimal mark, separator mark, the input decimal mark, etc. Something like this: \setupdigits [inputdecimal={.}, % input 3.1415926535 decimal={,} separator=\space, groupsize=4, % output 3,1415 9265 45 signspace=,] % +3.14159... That could even tie into \setuplanguage to allow setting language-specific defaults. Would anyone be interested in this?
We've already got \setdigitmode, \setdigitorder, and \setdigitspace; it might make sense to create a \setupdigits to consolidate these setups into one interface. Something like this:
\setupdigits [mode=4, % -->\setdigitmode{4} % (decimal period, thinspace between groups) inputdecimalmark={,}, % -->\setdigitorder{0} signspace=yes, % -->\setdigitsign{1}; '+ 1.4', not '+1.4' times=\times, % or times=\cdot ]
+1
P.s: I've been thinking I'd like to write more contexty interface that doesn't use predefined modes, but lets you setup the decimal mark, separator mark, the input decimal mark, etc. Something like this:
\setupdigits [inputdecimal={.}, % input 3.1415926535 decimal={,} separator=\space, groupsize=4, % output 3,1415 9265 45 signspace=,] % +3.14159...
That could even tie into \setuplanguage to allow setting language-specific defaults. Would anyone be interested in this?
+1 again!
--
Romain Diss
On 5/21/2013 11:35 PM, Romain Diss wrote:
We've already got \setdigitmode, \setdigitorder, and \setdigitspace; it might make sense to create a \setupdigits to consolidate these setups into one interface. Something like this:
\setupdigits [mode=4, % -->\setdigitmode{4} % (decimal period, thinspace between groups) inputdecimalmark={,}, % -->\setdigitorder{0} signspace=yes, % -->\setdigitsign{1}; '+ 1.4', not '+1.4' times=\times, % or times=\cdot ]
+1
P.s: I've been thinking I'd like to write more contexty interface that doesn't use predefined modes, but lets you setup the decimal mark, separator mark, the input decimal mark, etc. Something like this:
\setupdigits [inputdecimal={.}, % input 3.1415926535 decimal={,} separator=\space, groupsize=4, % output 3,1415 9265 45 signspace=,] % +3.14159...
That could even tie into \setuplanguage to allow setting language-specific defaults. Would anyone be interested in this?
+1 again!
needs a bit of thinking as when we start this route we get lots of new keywords (with the danger of introducing inconsistencies) so first we need to collect all potential candidates for such keys (e.g. using separator might be too generic ) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Le mercredi 22 mai 2013, Hans Hagen a écrit :
On 5/21/2013 11:35 PM, Romain Diss wrote:
We've already got \setdigitmode, \setdigitorder, and \setdigitspace; it might make sense to create a \setupdigits to consolidate these setups into one interface. Something like this:
\setupdigits
[mode=4, % -->\setdigitmode{4}
% (decimal period, thinspace between groups)
inputdecimalmark={,}, % -->\setdigitorder{0} signspace=yes, % -->\setdigitsign{1}; '+ 1.4', not '+1.4' times=\times, % or times=\cdot ]
+1
P.s: I've been thinking I'd like to write more contexty interface that doesn't use predefined modes, but lets you setup the decimal mark, separator mark, the input decimal mark, etc. Something like this:
\setupdigits
[inputdecimal={.}, % input 3.1415926535
decimal={,} separator=\space, groupsize=4, % output 3,1415 9265 45 signspace=,] % +3.14159...
That could even tie into \setuplanguage to allow setting language-specific defaults. Would anyone be interested in this?
+1 again!
needs a bit of thinking as when we start this route we get lots of new keywords (with the danger of introducing inconsistencies) so first we need to collect all potential candidates for such keys (e.g. using separator might be too generic )
I don't know if it is possible and can not estimate how much work it
represents but maybe one can consider to merge the digit part of the \digits
and \unit code.
The \unit command would then use the same code as the \digit one to format the
digit part. Then, the \unit code would use a specific code to format the unit
part.
This would make it possible to configure the digit formatting with one unique
command for both \unit and \digit and another command would be used to
configure the formating of the unit part.
--
Romain Diss
participants (4)
-
Christian Prim
-
Hans Hagen
-
Romain Diss
-
Sietse Brouwer