Re: [NTG-context] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Following up on the work-around, here is my improved code for xtable.

What doesn’t work is:

* alignment on the decimal separator takes place only in the first column with 
decimals (i.e. B), not on the  following one; this is independent of R1 having 
a decimal value in this column or not

* row spanning is now tricky since the width of the header column is taken for 
the first of the three rows spanned, which becomes even more complicated with 
option=stretch, I guess if I right align the second column and would phantomize 
the hsize of the header, this could work with a bit of optimization.

What I like about this approach however is that one could read the two 
arguments from a CSV file, which would save a lot of typing (and to manually 
specify the padding).

\def\mpm#1#2{
\doifsomethingelse{#2}{
\startxcell[align=left] \digits{#1} \stopxcell
\startxcell ± \stopxcell
\startxcell \digits{#2} \stopxcell
}{
\startxcell[align=left] \digits{#1} \stopxcell
\startxcell \stopxcell
\startxcell \digits{#2} \stopxcell
}
}

\startxtable[split=repeat, aligncharacter=yes, alignmentcharacter={.}]

\startxtablehead
\startxrow[topframe=on, foregroundstyle=bold]
\startxcell A \stopxcell
\startxcell[align=left, nx=3] Bla bla bla bla bla bla bla bla 
\stopxcell
\startxcell C \stopxcell
\stopxrow
\stopxtablehead

\startxtablebody
\startxrow[topframe=on]
\startxcell R1 \stopxcell
\mpm{12.3}{}%{1.5}
\startxcell one \stopxcell
\stopxrow

\startxrow
\startxcell R2 \stopxcell
\mpm{0.01}{0.023}
\startxcell two \stopxcell
\stopxrow

\startxrow
\startxcell R3 \stopxcell
\mpm{2.3}{0.1}
\startxcell three\stopxcell
\stopxrow

\stopxtablebody

\stopxtable 

> On 7 May 2020, at 21:22, Benjamin Buchmuller  
> wrote:
> 
> Hi Wolfgang,
> 
> you are (of course) right again. I realised that I wouldn’t get the expected 
> behaviour after checking the snippet isolated from my document’s context, 
> where it is embedded in a \startplacetable[…]{}{}. I’m still learning to get 
> the gist of the \doifs, the curly and square bracketed arguments and so on. 
> Thanks for the hint! 
> 
> Seems like I’m going to make three cells and span the header column for now, 
> though I guess it would be a nice feature to have the padding working in the 
> other cases.
> 
> I’ll write a feature request for no 4.
> 
> Thanks!
> 
> 
>> On 7 May 2020, at 20:00, Wolfgang Schuster 
>>  wrote:
>> 
>> Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:
>>> Hi Wolfang,
>>> Thank you for your reply. I have indeed not explained my intended result 
>>> very clearly.
>>> 1.
>>> Primarily, I need to get the two values aligned at the digit separator of 
>>> the first and second number respectively and overall at the ± sign. I’m 
>>> working in an xtable, where I have entries such as
>>> \startxcell \mpm{14.0==}{_1.5==} \stopxcell
>>> \startxcell \mpm{_0.034}{_0.013} \stopxcell
>>> and defined
>>> \def\mpm#1#2{
>>> \ifsecondargument
>>> \digits{#1}\,±\,\digits{#2}%
>>> \else
>>> \digits{#1}%
>>> \fi
>>> }
>> 
>> Is there something missing in here because the \ifsecondargument check here 
>> makes non sense because the second argument is mandatory and not optional.
>> 
>> Is this what you want?
>> 
>> \define[2]\mpm
>> {\digits{#1}%
>>  \doifsomething{#2}{\,±\,\digits{#2}}}
>> 
>>> Since I was hoping that I could exploit the zeropadding of \digits to get 
>>> the format right. Indeed, it would save a lot of typing, if I wouldn’t have 
>>> to specify the padding manually and I vaguely recall that there is 
>>> somewhere a ConTeXt solution that can make such alignments, but I simply 
>>> can’t find it any more …
>> 
>> You can align number on the decimal point (comma) but this works only when 
>> you have only one number in a cell.
>> 
>> \starttext
>> 
>> \startxtable[aligncharacter=yes,alignmentcharacter=±]
>>   \startxrow
>>   \startxcell
>>   \digits {14.0} ± \digits {1.5}
>>   \stopxcell
>>   \stopxrow
>>   \startxrow
>>   \startxcell
>>   \digits {0.034} ± \digits {0.013}
>>   \stopxcell
>>   \stopxrow
&

[NTG-context] mkiv \digits{2.0=} zero padding feature request

2020-05-07 Thread Benjamin Buchmuller
Hi,


As Wolfgang has figured out, zero padding in \digits only works for trailing 
(and omitted) zeroes when immediately preceded by the decimal separator.

It would be nice if this would work even if there is a number preceding, so that

\digits{3.1=}x\crlf
\digits{3.==}x\crlf
\digits{3.14}x

would align at the decimal separator when right aligned. This is useful in some 
circumstances, where the number of significant digits varies between sources, 
so that one needs to typset for example 

\digits{3.1=}±\digits{0.5}\crlf
\digits{3.28}±\digits{0.12}


Thanks!


Benjamin
___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi Wolfgang,

you are (of course) right again. I realised that I wouldn’t get the expected 
behaviour after checking the snippet isolated from my document’s context, where 
it is embedded in a \startplacetable[…]{}{}. I’m still learning to get the gist 
of the \doifs, the curly and square bracketed arguments and so on. Thanks for 
the hint! 

Seems like I’m going to make three cells and span the header column for now, 
though I guess it would be a nice feature to have the padding working in the 
other cases.

I’ll write a feature request for no 4.

Thanks!


> On 7 May 2020, at 20:00, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:
>> Hi Wolfang,
>> Thank you for your reply. I have indeed not explained my intended result 
>> very clearly.
>> 1.
>> Primarily, I need to get the two values aligned at the digit separator of 
>> the first and second number respectively and overall at the ± sign. I’m 
>> working in an xtable, where I have entries such as
>> \startxcell \mpm{14.0==}{_1.5==} \stopxcell
>> \startxcell \mpm{_0.034}{_0.013} \stopxcell
>> and defined
>> \def\mpm#1#2{
>>  \ifsecondargument
>>  \digits{#1}\,±\,\digits{#2}%
>>  \else
>>  \digits{#1}%
>>  \fi
>> }
> 
> Is there something missing in here because the \ifsecondargument check here 
> makes non sense because the second argument is mandatory and not optional.
> 
> Is this what you want?
> 
> \define[2]\mpm
>  {\digits{#1}%
>   \doifsomething{#2}{\,±\,\digits{#2}}}
> 
>> Since I was hoping that I could exploit the zeropadding of \digits to get 
>> the format right. Indeed, it would save a lot of typing, if I wouldn’t have 
>> to specify the padding manually and I vaguely recall that there is somewhere 
>> a ConTeXt solution that can make such alignments, but I simply can’t find it 
>> any more …
> 
> You can align number on the decimal point (comma) but this works only when 
> you have only one number in a cell.
> 
> \starttext
> 
> \startxtable[aligncharacter=yes,alignmentcharacter=±]
>\startxrow
>\startxcell
>\digits {14.0} ± \digits {1.5}
>\stopxcell
>\stopxrow
>\startxrow
>\startxcell
>\digits {0.034} ± \digits {0.013}
>\stopxcell
>\stopxrow
> \stopxtable
> 
> \stoptext
> 
>> 2. + 3.
>> Absolutely right, this is my bad. I have badly mixed from Hans’ solution to 
>> a similar problem,
>> https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html
>> which was actually \def\zeroamount{-} and the example in the source, I 
>> didn’t read properly. Just skip that part. :)
> 
> The message is from 2003!
> 
>> 4.
>> Indeed,
>> \startxcell \mpm{14.==}{_1.5=} \stopxcell
>> \startxcell \mpm{_0.03}{_0.01} \stopxcell
>> aligns properly. But sometimes, I have the first digit specified, but not 
>> the second and unfortunately this doesn’t work
>> \startxcell \mpm{14.5=}{_1.5=} \stopxcell
>> \startxcell \mpm{_0.03}{_0.01} \stopxcell
>> because = is not immediately preceded by .
> 
> Can you write another mail with a request for this.
> 
> Wolfgang

___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Wolfgang Schuster

Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:

Hi Wolfang,

Thank you for your reply. I have indeed not explained my intended result very 
clearly.

1.

Primarily, I need to get the two values aligned at the digit separator of the 
first and second number respectively and overall at the ± sign. I’m working in 
an xtable, where I have entries such as

\startxcell \mpm{14.0==}{_1.5==} \stopxcell
\startxcell \mpm{_0.034}{_0.013} \stopxcell

and defined

\def\mpm#1#2{
\ifsecondargument
\digits{#1}\,±\,\digits{#2}%
\else
\digits{#1}%
\fi
}


Is there something missing in here because the \ifsecondargument check 
here makes non sense because the second argument is mandatory and not 
optional.


Is this what you want?

\define[2]\mpm
  {\digits{#1}%
   \doifsomething{#2}{\,±\,\digits{#2}}}


Since I was hoping that I could exploit the zeropadding of \digits to get the 
format right. Indeed, it would save a lot of typing, if I wouldn’t have to 
specify the padding manually and I vaguely recall that there is somewhere a 
ConTeXt solution that can make such alignments, but I simply can’t find it any 
more …


You can align number on the decimal point (comma) but this works only 
when you have only one number in a cell.


\starttext

\startxtable[aligncharacter=yes,alignmentcharacter=±]
\startxrow
\startxcell
\digits {14.0} ± \digits {1.5}
\stopxcell
\stopxrow
\startxrow
\startxcell
\digits {0.034} ± \digits {0.013}
\stopxcell
\stopxrow
\stopxtable

\stoptext


2. + 3.

Absolutely right, this is my bad. I have badly mixed from Hans’ solution to a 
similar problem,

https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html

which was actually \def\zeroamount{-} and the example in the source, I didn’t 
read properly. Just skip that part. :)


The message is from 2003!


4.

Indeed,

\startxcell \mpm{14.==}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

aligns properly. But sometimes, I have the first digit specified, but not the 
second and unfortunately this doesn’t work

\startxcell \mpm{14.5=}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

because = is not immediately preceded by .


Can you write another mail with a request for this.

Wolfgang
___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi Wolfang,

Thank you for your reply. I have indeed not explained my intended result very 
clearly. 

1. 

Primarily, I need to get the two values aligned at the digit separator of the 
first and second number respectively and overall at the ± sign. I’m working in 
an xtable, where I have entries such as

\startxcell \mpm{14.0==}{_1.5==} \stopxcell
\startxcell \mpm{_0.034}{_0.013} \stopxcell

and defined 

\def\mpm#1#2{
\ifsecondargument
\digits{#1}\,±\,\digits{#2}%
\else
\digits{#1}%
\fi
}

Since I was hoping that I could exploit the zeropadding of \digits to get the 
format right. Indeed, it would save a lot of typing, if I wouldn’t have to 
specify the padding manually and I vaguely recall that there is somewhere a 
ConTeXt solution that can make such alignments, but I simply can’t find it any 
more …

2. + 3.

Absolutely right, this is my bad. I have badly mixed from Hans’ solution to a 
similar problem, 

https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html

which was actually \def\zeroamount{-} and the example in the source, I didn’t 
read properly. Just skip that part. :)

4. 

Indeed, 

\startxcell \mpm{14.==}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

aligns properly. But sometimes, I have the first digit specified, but not the 
second and unfortunately this doesn’t work

\startxcell \mpm{14.5=}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

because = is not immediately preceded by .



> On 7 May 2020, at 18:21, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 07.05.2020 um 17:31:
>> Hi,
>> I’m trying to get
>> \digits{15.0=}±\digits{1.00}
>> \digits{_8.12}±\digits{0.34}
>> horizontally aligned as
>> 15.0 ±1.00
>>  8.12±0.34
>> But I get
>> 15.0±1.00
>>  8.12±0.34
>> instead.
>> From the source (phys-dim.mkiv), I can see that “=“ should expand to 
>> \hphantom{0}. (I think \zeropoint in the table is outdated, since 
>> \def\zeropoint\hphantom{0} does not solve the problem either.)
> 
> 1. Which table?
> 
> 2. This is not how \def works.
> 
> 3. When you redefine \zeropoint (which isn't a macro) you're going to break 
> everything.
> 
>> I can’t use tabulate or alignment in math mode for this problem 
>> unfortunately.
> 
> I looked at the code and the problem is = can only be used to insert space 
> for two digits (e.g. 100.==).
> 
> Wolfgang

___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Wolfgang Schuster

Benjamin Buchmuller schrieb am 07.05.2020 um 17:31:

Hi,

I’m trying to get

\digits{15.0=}±\digits{1.00}

\digits{_8.12}±\digits{0.34}

horizontally aligned as

15.0 ±1.00
  8.12±0.34

But I get

15.0±1.00
  8.12±0.34

instead.

 From the source (phys-dim.mkiv), I can see that “=“ should expand to 
\hphantom{0}. (I think \zeropoint in the table is outdated, since 
\def\zeropoint\hphantom{0} does not solve the problem either.)


1. Which table?

2. This is not how \def works.

3. When you redefine \zeropoint (which isn't a macro) you're going to 
break everything.



I can’t use tabulate or alignment in math mode for this problem unfortunately.


I looked at the code and the problem is = can only be used to insert 
space for two digits (e.g. 100.==).


Wolfgang
___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi,

I’m trying to get

\digits{15.0=}±\digits{1.00}

\digits{_8.12}±\digits{0.34}

horizontally aligned as

15.0 ±1.00
 8.12±0.34

But I get

15.0±1.00
 8.12±0.34

instead.

From the source (phys-dim.mkiv), I can see that “=“ should expand to 
\hphantom{0}. (I think \zeropoint in the table is outdated, since 
\def\zeropoint\hphantom{0} does not solve the problem either.)

I can’t use tabulate or alignment in math mode for this problem unfortunately.

Any hints would be very welcome.

Thanks


Benjamin
___
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] configure \digits errata

2019-08-25 Thread Damien Thiriet
Hi, 


I made a mistake in my previous mail.
I am looking for an alternativ to \setdigitmode

\starttext
\setdigitmode 3 \digits 1314000
\stoptext

with an output points or thinmuskip
Sorry for the noise,


Damien Thiriet
___
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] configure \digits

2019-08-25 Thread Damien Thiriet
Hi,


According to the wiki and 2003 article Pasting Digits together,
to get 1314000 typeset as 1\,314\,000, I should do
\setdigits 3 \digits{1314000}

unfortunatly, the \setdigits command looks obsolete (MkII command?
Could not find in my ConTeXt help information server
(http://localhost:8088/mtx-server-ctx-help.lua? and so on…).
I am using 2018 texlive.

Maybe job is now done by \setupunit, but couldn't figure out
how it works.

So what should I do to have numbers typeset the French way
(points or thinmuskip)?

MWE to be improved

\starttext
\setdigits 3 \digits{1314000}
\stoptext

Thanks,

Damien Thiriet 
___
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] Feature request: \digits command

2018-04-29 Thread Peter Münster
On Wed, Jun 25 2008, Flavien Lambert wrote:

> did not found a way to cut a number by group of three digits like the
> numprint command, e.g. 100 becomes 1 000 000. With the digits
> option 3, dots become thinmuskips. I would like to do something
> similar but automatically for groups of three digits.

Hi,

Does this feature exist now in ConTeXt?

TIA for any hints,
-- 
   Peter
___
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] Persian digits in math formulas

2013-08-17 Thread Wolfgang Schuster

Am 17.08.2013 um 09:57 schrieb Mingranina Gingranina mingran...@gmail.com:

 With the above code the digits are not changed to persian. For your
 information I have
 attached the source, log, and PDF files. 

The following example from Hans worked in my system:

\usetypescriptfile[mathdigits]

\usetypescript [mathdigits] [xits-dejavu] [arabicindic]

\setupbodyfont[dejavu]

\starttext
   $3+2=5 \quad \bf 3+2=5$
\stoptext

 Please note that I have changed '\setupbodyfont[dejavu] to
 \setupbodyfont[dejavusans]
 because the font 'dejavu' is not installed on my system.

The DejaVu fonts are shipped with your context installation and you can use them
with \setupbodyfont[dejavu], when you write \setupbodyfont[dejavusans] context
uses Latin Modern because there is no typeface with the name “dejavusans”.

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


Re: [NTG-context] Persian digits in math formulas

2013-08-17 Thread Mingranina Gingranina
On 8/17/13, Wolfgang Schuster schuster.wolfg...@gmail.com wrote:

 The following example from Hans worked in my system:

 \usetypescriptfile[mathdigits]

 \usetypescript [mathdigits] [xits-dejavu] [arabicindic]

 \setupbodyfont[dejavu]

 \starttext
$3+2=5 \quad \bf 3+2=5$
 \stoptext

 Dear Wolfgang Schuster,
 Hello

 The above code works on my system too, but in text mode the digits
are still in English.

 The DejaVu fonts are shipped with your context installation and you can use
 them
 with \setupbodyfont[dejavu], when you write \setupbodyfont[dejavusans]
 context
 uses Latin Modern because there is no typeface with the name “dejavusans”.

 Do you know in which files are these typefaces defined? I want to use
them as sample
 files and define my own typefaces (if I can at all).

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


[NTG-context] Persian digits in math formulas

2013-08-15 Thread Mingranina Gingranina
Dear All,
 Hello,

 I am trying to use Persian digits in math formulas. My document reads:

\font\4 = {name:dejavusans} at 10pt

\font\5 = {name:dejavusans} at 7pt

\font\6 = {name:dejavusans} at 5pt

\textfont4=\4 \scriptfont4=\5 \scriptscriptfont4=\6

\Umathcode`3=14`۳

\definefontfeature [persian] [arabic]

\mainlanguage[pe]

\starttext

  \definedfont[dejavusans*persian]

  \setupalign[r2l]

این یک آزمایش است.

  3+2=5

  $3+2=5$

\setupalign[l2r]

This is a test.

  3+2=5

  $3+2=5$

\stoptext

 However in the output the replaced digit 3 disappears.
 Any help is gratefully appreciated.

 Thanks,
 Mingranina
___
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
___

Re: [NTG-context] Persian digits in math formulas

2013-08-15 Thread Hans Hagen

On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:

Dear All,
  Hello,

  I am trying to use Persian digits in math formulas. My document reads:

\font\4 = {name:dejavusans} at 10pt

\font\5 = {name:dejavusans} at 7pt

\font\6 = {name:dejavusans} at 5pt

\textfont4=\4 \scriptfont4=\5 \scriptscriptfont4=\6

\Umathcode`3=14`۳

\definefontfeature [persian] [arabic]

\mainlanguage[pe]

\starttext

   \definedfont[dejavusans*persian]

   \setupalign[r2l]

 این یک آزمایش است.

   3+2=5

   $3+2=5$

 \setupalign[l2r]

 This is a test.

   3+2=5

   $3+2=5$

\stoptext

  However in the output the replaced digit 3 disappears.
  Any help is gratefully appreciated.


For a text font you can add:

\definefontfeature [persian-fake-math] [arabic] [anum=yes]

and say:

\definedfont[dejavusans*persian-fake-math]

but ... nicer is this:

\mainlanguage[pe]

\usetypescriptfile[dejavu]

\definetypeface [dejavu] [rm] [serif] [dejavu]   [default]
\definetypeface [dejavu] [ss] [sans]  [dejavu]   [default]
\definetypeface [dejavu] [tt] [mono]  [dejavu]   [default]
\definetypeface [dejavu] [mm] [math]  [xitsbidi] [default] 
[direction=both,rscale=1.2]


\setuptypeface[dejavu]

\starttext

\start \setupalign[r2l] \setupmathematics[align=r2l] arabic: این یک 
آزمایش است. \par text: 3+2=5 \par math: $3+2=5$ $\sqrt{3+2=5}$ \par \stop


\start \setupalign[l2r] \setupmathematics[align=l2r] latin:  This 
is a test.\par text: 3+2=5 \par math: $3+2=5$ $\sqrt{3+2=5}$\par \stop


\stoptext

(see bidi-001.tex in the test suite)

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
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Persian digits in math formulas

2013-08-15 Thread Mingranina Gingranina
On 8/15/13, Hans Hagen pra...@wxs.nl wrote:
 On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:
 Dear All,
   Hello,

   I am trying to use Persian digits in math formulas. My document reads:

 \font\4 = {name:dejavusans} at 10pt

 \font\5 = {name:dejavusans} at 7pt

 \font\6 = {name:dejavusans} at 5pt

 \textfont4=\4 \scriptfont4=\5 \scriptscriptfont4=\6

 \Umathcode`3=14`۳

 \definefontfeature [persian] [arabic]

 \mainlanguage[pe]

 \starttext

\definedfont[dejavusans*persian]

\setupalign[r2l]

  این یک آزمایش است.

3+2=5

$3+2=5$

  \setupalign[l2r]

  This is a test.

3+2=5

$3+2=5$

 \stoptext

   However in the output the replaced digit 3 disappears.
   Any help is gratefully appreciated.

 For a text font you can add:

 \definefontfeature [persian-fake-math] [arabic] [anum=yes]

 and say:

  \definedfont[dejavusans*persian-fake-math]

 but ... nicer is this:

 \mainlanguage[pe]

 \usetypescriptfile[dejavu]

 \definetypeface [dejavu] [rm] [serif] [dejavu]   [default]
 \definetypeface [dejavu] [ss] [sans]  [dejavu]   [default]
 \definetypeface [dejavu] [tt] [mono]  [dejavu]   [default]
 \definetypeface [dejavu] [mm] [math]  [xitsbidi] [default]
 [direction=both,rscale=1.2]

 \setuptypeface[dejavu]

 \starttext

  \start \setupalign[r2l] \setupmathematics[align=r2l] arabic: این یک
 آزمایش است. \par text: 3+2=5 \par math: $3+2=5$ $\sqrt{3+2=5}$ \par \stop

  \start \setupalign[l2r] \setupmathematics[align=l2r] latin:  This
 is a test.\par text: 3+2=5 \par math: $3+2=5$ $\sqrt{3+2=5}$\par \stop

 \stoptext

 (see bidi-001.tex in the test suite)

 Dear Hans,
 Hello

 Thank you very much for your reply.
 A math formula In Persian language is exactly the same as in English
language except that the
 digits should be written in Persian. So what I want to do is to
replace the English digits with
 Persian digits in a math formula. However, with your code not only
the formula is right aligned, but
 also the square root symbol is mirrored.

 By the way, I couldn't find bidi-001.tex on ConTeXt Site, would you
please let me know where can
 I get it?

 Thanks,
 Mingranina


 The problem wi



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

Re: [NTG-context] Persian digits in math formulas

2013-08-15 Thread Marco Patzer
On 2013–08–15 Mingranina Gingranina wrote:

  By the way, I couldn't find bidi-001.tex on ConTeXt Site, would
  you please let me know where can I get it?

It's here:

  http://pragma-ade.com/context/latest/cont-tst.7z

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Persian digits in math formulas

2013-08-15 Thread Wolfgang Schuster

Am 15.08.2013 um 19:30 schrieb Mingranina Gingranina mingran...@gmail.com:

 By the way, I couldn't find bidi-001.tex on ConTeXt Site, would you
 please let me know where can I get it?


The file is part of Hans test suite you can find on his homepage:

- http://pragma-ade.com/download-1.htm
- http://pragma-ade.com/context/latest/cont-tst.7z

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

Re: [NTG-context] Persian digits in math formulas

2013-08-15 Thread Hans Hagen

On 8/15/2013 7:30 PM, Mingranina Gingranina wrote:

On 8/15/13, Hans Hagen pra...@wxs.nl wrote:

On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:



  A math formula In Persian language is exactly the same as in English
language except that the
  digits should be written in Persian. So what I want to do is to
replace the English digits with
  Persian digits in a math formula. However, with your code not only
the formula is right aligned, but
  also the square root symbol is mirrored.


Assuming that you use math consistently ...

\starttypescript [mathdigits] [all]
\resetfontfallback [mathdigits]
\stoptypescript

\starttypescript [mathdigits] [arabicindic]
\definefontfallback [mathdigits] [dejavusansmono] 
[0x0660-0x0669] [check=yes,force=yes,offset=digitsnormal]
\definefontfallback [mathdigits] [dejavusansmonobold] 
[0x0660-0x0669] [check=yes,force=yes,offset=digitsbold]

\stoptypescript

\starttypescript [mathdigits] [extendedarabicindic]
\definefontfallback [mathdigits] [dejavusansmono] 
[0x06F0-0x06F9] [check=yes,force=yes,offset=digitsnormal]
\definefontfallback [mathdigits] [dejavusansmonobold] 
[0x06F0-0x06F9] [check=yes,force=yes,offset=digitsbold]

\stoptypescript

% % in next beta: a few more ranges
%
% \starttypescript [mathdigits] [arabicindic,extendedarabicindic]
% \resetfontfallback  [mathdigits]
% \definefontfallback [mathdigits] [dejavusansmono] 
[digits\typescripttwo] [check=yes,force=yes,offset=digitsnormal]
% \definefontfallback [mathdigits] [dejavusansmonobold] 
[digits\typescripttwo] [check=yes,force=yes,offset=digitsbold]

% \stoptypescript

\usetypescript [mathdigits][arabicindic]

\starttypescript [math] [xits] [name]

\definefontsynonym[MathRoman][file:xits-math.otf][features=math\mathsizesuffix,goodies=xits-math,fallbacks=mathdigits]
\stoptypescript

\setupbodyfont[dejavu]

\starttext

$3+2=5 \quad \bf 3+2=5$

\stoptext

I'm not sure yet how to organize such things in a predefined typescript.

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
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Persian digits in math formulas

2013-08-15 Thread Hans Hagen

On 8/15/2013 7:30 PM, Mingranina Gingranina wrote:

On 8/15/13, Hans Hagen pra...@wxs.nl wrote:

On 8/15/2013 4:22 PM, Mingranina Gingranina wrote:



  A math formula In Persian language is exactly the same as in English
language except that the
  digits should be written in Persian. So what I want to do is to
replace the English digits with
  Persian digits in a math formula. However, with your code not only
the formula is right aligned, but
  also the square root symbol is mirrored.


In the next beta you can do this (bidi-006.tex):

\usetypescriptfile[mathdigits]

\usetypescript [mathdigits] [xits-dejavu] [arabicindic]

\setupbodyfont[dejavu]

\starttext
$3+2=5 \quad \bf 3+2=5$
\stoptext

Of course we need to add more combinations.

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
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-22 Thread Hans Hagen

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


Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-22 Thread Romain Diss
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
romain.d...@yahoo.fr
___
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
___


[NTG-context] \digits get \times instead of \cdot before exponent

2013-05-21 Thread Christian Prim
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 67?

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

Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-21 Thread Romain Diss
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 67?
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
romain.d...@yahoo.fr
___
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
___

Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-21 Thread 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.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 67?

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
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-21 Thread Christian Prim
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 pra...@wxs.nl

 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
  67?

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

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

Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-21 Thread 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
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-21 Thread Christian Prim
Now it's perfect! Will this be included in the next version of context?

Christian


2013/5/21 Hans Hagen pra...@wxs.nl

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

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

Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-21 Thread Sietse Brouwer
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?
___
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
___


Re: [NTG-context] \digits get \times instead of \cdot before exponent

2013-05-21 Thread Romain Diss
 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
romain.d...@yahoo.fr
___
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
___


[NTG-context] Reflections the interplay between units and digits

2011-08-26 Thread Ian Lawrence
Morning all…

I think that there are several issues in the interplay of the \units and 
\digits command that could be a bit better (Sorry Hans…all meant in the best 
possible way).



digits_trial.pdf
Description: Adobe PDF document

So here is a complete example and the pdf I get, after some experimentation. 
With kludges of my own. I'd guess there are several people using ConTEXt for 
the sciences, so this may help some, or some may set me on a better path…

___

\starttext
\setdigitmode 6

{\em digit exponent powers - don't work}

\digits{20e-12}

\digits{-123.222,00e-12} % this one gives nothing at all

But it seems it should \emdash\ ConTEXt magazine3 May 2003, from which the 
following non-working examples come

\digits 123.222,00^10 % this one gives nothing at all

\digits 123.222,00e10 % this one gives nothing at all

\digits /123.222,00e-12 % this one gives nothing at all

\digits -123.222,00e-12 % this one gives nothing at all

\digits +123.222,00e-12 % this one gives nothing at all

{\em spacing and decimal points}


\digits 12,345,000.90


Has the same effect as this hard-coded beasty.


12~345~000.78

Digits without exponents seem to work

\digits 1230.92


\digits{12,460,800.89}


{\em Now a little challenge - write out the speed of light, with units. So to 
combine units with digits}


\unit{299792458 meter inverse second} % en-route, but I'd like every three 
digits separated by a non-breaking space

So try the digits command - two possibilities

%\digit {\unit{299792458 meter inverse second}} % digits nests units - well the 
interpreter rejected this one


%\unit{\digit{299792458} meter inverse second} % units nests digits - and this 
one.

Conclusion digits and units don't play nicely together...unless someone has a 
nice solution


Maybe a bit hard coding - fugly, but maybe...


\unit{299~792~458 meter inverse second} % fails to interpret units, so no good

299~792~\unit{458 meter inverse second} % looks OK, but inelegant

Now for trying to write in standard form..first the inelegant form, but giving 
a passable result

Speed = 3 \times\ \unit{10^8 meter inverse second}

But I'd guess this will not be inside a tex box, so the layout might be 
dodgy... numbers and units should not be split over two lines...

A much more elegant solution would be:

Speed = \unit{3e8 meter inverse second} % the documentation seems to support 
this, but not the practice...

This one would be cleanly coded, if only the exponentiation worked... 


{\em spread of a physical quantity}
One more, whilst I'm here. People will want to indicate a spread in a physical 
quantity, so:

\unit{400\endash 700 THz}   % inserts an unwanted space after the 400: ( 400 
–700 THz). (cf 11\endash 14 , which 'behaves' as expected

You can again kludge, by

400\endash \unit{700 THz}

But elegant coding it ain't \ldots and again probably no bounding tex box, so 
may get split over two lines.

\stoptext

___

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

Re: [NTG-context] Digits-Module in tabulate does not work

2011-06-12 Thread yoraxe
Am 09.06.2011 23:16, schrieb Wolfgang Schuster:
 I guess the \pm has to be in $$. If I type

 \NN (30$\pm$3)e-3

 there's 'e-3' in the pdf-file again. The \NN somewhere between the digit
 only creates a big space (new column).

 Sorry for being so slow on the uptake.
 
 The \NN column expects a valid \digits argument but your code isn’t supported.
 You can now resort to math mode or write your own digits code.

Sad, that this isn't supported. I think this is a very popular notation.
I'm not that skilled until now to write my own code.
Woud be nice, if someone, who also uses this, could give an example how
to reach an easy success without typing something like $\cdot 10^{-3}$.

So far so good.

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


[NTG-context] Digits-Module in tabulate does not work

2011-06-09 Thread yoraxe
Hi,

I'm using the digit-module and enjoy, that I get a nice output using the
following:

\starttext
\digits{30e-3}
\stoptext

instead of

\starttext
$30 \cdot 10^{-3}$ or $30 ⋅ 10^{-3}$
\stoptext

But now I'm wondering why this module does not work in the
tabulate-environment with:

\starttabulate[|l|l]
\HL
\NC first \NC second \AR
\HL
\NC \digits{30e-3}\NC \digits{30e+3} \AR
\HL
\stoptabulate

In the pdf-file now appears only 30e-3.

Thanks,

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

Re: [NTG-context] Digits-Module in tabulate does not work

2011-06-09 Thread Wolfgang Schuster

Am 09.06.2011 um 22:24 schrieb yoraxe:

 Hi,
 
 I'm using the digit-module and enjoy, that I get a nice output using the
 following:
 
 \starttext
 \digits{30e-3}
 \stoptext
 
 instead of
 
 \starttext
 $30 \cdot 10^{-3}$ or $30 ⋅ 10^{-3}$
 \stoptext
 
 But now I'm wondering why this module does not work in the
 tabulate-environment with:
 
 \starttabulate[|l|l]
 \HL
 \NC first \NC second \AR
 \HL
 \NC \digits{30e-3}\NC \digits{30e+3} \AR
 \HL
 \stoptabulate
 
 In the pdf-file now appears only 30e-3.

\starttext

\starttabulate[|l|l|]
\HL
\NC first \NC second \NC\NR
\HL
\NN 30e-3 \NN 30e+3  \NC\NR
\HL
\stoptabulate

\stoptext

Wolfgang

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

Re: [NTG-context] Digits-Module in tabulate does not work

2011-06-09 Thread yoraxe
Am 09.06.2011 22:31, schrieb Wolfgang Schuster:
 Am 09.06.2011 um 22:24 schrieb yoraxe:

   
 Hi,

 I'm using the digit-module and enjoy, that I get a nice output using the
 following:

 \starttext
 \digits{30e-3}
 \stoptext

 instead of

 \starttext
 $30 \cdot 10^{-3}$ or $30 ⋅ 10^{-3}$
 \stoptext

 But now I'm wondering why this module does not work in the
 tabulate-environment with:

 \starttabulate[|l|l]
 \HL
 \NC first \NC second \AR
 \HL
 \NC \digits{30e-3}\NC \digits{30e+3} \AR
 \HL
 \stoptabulate

 In the pdf-file now appears only 30e-3.
 
 \starttext

 \starttabulate[|l|l|]
 \HL
 \NC first \NC second \NC\NR
 \HL
 \NN 30e-3 \NN 30e+3  \NC\NR
 \HL
 \stoptabulate

 \stoptext

 Wolfgang
   
Thanks. That was very easy. But where do I have to put the \NN when I
use something like

(30 \pm 3)e-3

?

I guess the \pm has to be in $$. If I type

\NN (30$\pm$3)e-3

there's 'e-3' in the pdf-file again. The \NN somewhere between the digit
only creates a big space (new column).

Sorry for being so slow on the uptake.

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

Re: [NTG-context] Digits-Module in tabulate does not work

2011-06-09 Thread Wolfgang Schuster

Am 09.06.2011 um 23:00 schrieb yoraxe:

 Thanks. That was very easy. But where do I have to put the \NN when I use 
 something like
 
 (30 \pm 3)e-3
 
 ?

The \NN command is place of the \NC command and adding another one will only 
start a new column.

 I guess the \pm has to be in $$. If I type
 
 \NN (30$\pm$3)e-3
 
 there's 'e-3' in the pdf-file again. The \NN somewhere between the digit
 only creates a big space (new column).
 
 Sorry for being so slow on the uptake.

The \NN column expects a valid \digits argument but your code isn’t supported.
You can now resort to math mode or write your own digits code.

Wolfgang

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


Re: [NTG-context] Cannot make \digits work with palatino

2010-01-04 Thread Aditya Mahajan

On Mon, 4 Jan 2010, Hans Hagen wrote:


On 3-1-2010 18:38, Alexandre Patry wrote:

Hi,

when I use the \digits command with default fonts, everything work fine.
  However, when I set the fonts to palatino, the following documents
print 1:234;56 instead of 1.234,56

8-
\usetypescript[palatino][ec]
\definetypeface [palatino] [mm] [math]   [euler] [euler][rscale=1.03]
\setupbodyfont[palatino,12pt]

\starttext
\digits{1.234,56}
\stoptext
8-

Am I doing something wrong?


it's euler related, not palatino so let's redirect this to aditya


It works if you change the definition of \dohandledigits to the following

\def\dohandledigits
  {\mathcode`\,=003B \mathcode`\.=003A % were 013B and 013A
   \expandafter\handletokens\collecteddigits\with\scandigits
   \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}

This is because euler takes , and . from mr family (family 0) while in 
other fonts they come from mi (family 1).


I don't understand why the mathcode needs to be changed inside 
dohandledigits, do cannot figure out a way to fix the bug. One option can 
be to store the mathcode of , and . before we start manipulating digits, 
and then restore them to their original values (something like that 
\pushcatcodetable and \popcatcodetable).


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


Re: [NTG-context] Cannot make \digits work with palatino

2010-01-04 Thread Alexandre Patry
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/04/2010 06:39 PM, Aditya Mahajan wrote:
 It works if you change the definition of \dohandledigits to the following
 
 \def\dohandledigits
   {\mathcode`\,=003B \mathcode`\.=003A % were 013B and 013A
\expandafter\handletokens\collecteddigits\with\scandigits
\ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}

Thank you very much, it works perfectly!

Alexandre
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJLQoh5AAoJEAMYf3C80LjbQ9UH/i+E4CpAfmubkHfPP5zaWga5
lz6ICqTM3gkAwgOfXs0yWif4GS5WBwRhM7AaZfEHJ+zlgjJi/iyKua7cNvEf+OrT
tkaNgNeQuQ2f1U3A0iwyA0+0YyBtUj4tfv+YblcKs9QMYWa/s5NCci1hK/16lvhJ
IoBU1+5ywIDX1Zvl8EGEDEDZnbDcwG5gtx/W+xaR38o3/wSNoEtywNW5M8AHwO+3
eS5ue4u2QFhoXtfvYsLbCp4CNIF86eAhuYaSUKv7GJKNOFoKUdgYUD5bGKHaz/nV
yse531LilFaXlFTlJsbbJDjW3rsDljK849yKF9lkukPtjst1nFl1o9+jm/YgRc4=
=Ja9Y
-END PGP SIGNATURE-
___
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
___


[NTG-context] Cannot make \digits work with palatino

2010-01-03 Thread Alexandre Patry
Hi,

when I use the \digits command with default fonts, everything work fine.
 However, when I set the fonts to palatino, the following documents
print 1:234;56 instead of 1.234,56

8-
\usetypescript[palatino][ec]
\definetypeface [palatino] [mm] [math]   [euler] [euler][rscale=1.03]
\setupbodyfont[palatino,12pt]

\starttext
\digits{1.234,56}
\stoptext
8-

Am I doing something wrong?

Thanks,

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


Re: [NTG-context] Metapost label - Truncating digits after decimal point

2009-12-15 Thread Aditya Mahajan

On Sat, 28 Nov 2009, Curiouslearn wrote:


Hi,

Is it possible to truncate the digits after decimal point in Metapost
when using textext()? Please see the minimal example below which
produces 1.84375. Can I just keep the first digit and have it produce
1.8 ?

Thanks.


If you are using mkiv, you can use lua to truncate a number.

\unexpanded\def\truncate#1{\ctxlua{context(\%.1f, #1)}}

\startMPdefinitions
  def truncatedtext(expr s) =
textext(\truncate{  s  })
  enddef ;
\stopMPdefinitions

\starttext
\startuseMPgraphic{Figure}
  u := 1cm;
  pickup pencircle scaled 2pt; % default pen thickness
  %TheFunction
  vardef f(expr x) =
  (10/x)-x*((0.5)**x)
  enddef;
  %Labels
  %label.lft(textext(\truncate{  decimal f(5)  }),(0,f(5)) scaled u);
  label.lft(truncatedtext(decimal f(5)),(0,f(5)) scaled u);
\stopuseMPgraphic
\useMPgraphic{Figure}


\stoptext

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


Re: [NTG-context] Metapost label - Truncating digits after decimal point

2009-12-15 Thread Curiouslearn
Thanks for this solution. Sounds small and clean. I need to learn Lua I guess.



On Tue, Dec 15, 2009 at 5:34 AM, Aditya Mahajan adit...@umich.edu wrote:
 On Sat, 28 Nov 2009, Curiouslearn wrote:

 Hi,

 Is it possible to truncate the digits after decimal point in Metapost
 when using textext()? Please see the minimal example below which
 produces 1.84375. Can I just keep the first digit and have it produce
 1.8 ?

 Thanks.

 If you are using mkiv, you can use lua to truncate a number.

 \unexpanded\def\truncate#1{\ctxlua{context(\%.1f, #1)}}

 \startMPdefinitions
  def truncatedtext(expr s) =
    textext(\truncate{  s  })
  enddef ;
 \stopMPdefinitions

 \starttext
 \startuseMPgraphic{Figure}
  u := 1cm;
  pickup pencircle scaled 2pt; % default pen thickness
  %TheFunction
  vardef f(expr x) =
          (10/x)-x*((0.5)**x)
  enddef;
  %Labels
  %label.lft(textext(\truncate{  decimal f(5)  }),(0,f(5)) scaled u);
  label.lft(truncatedtext(decimal f(5)),(0,f(5)) scaled u);
 \stopuseMPgraphic
 \useMPgraphic{Figure}


 \stoptext

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

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


Re: [NTG-context] Metapost label - Truncating digits after decimal point

2009-11-29 Thread Taco Hoekwater

Curiouslearn wrote:

Hi,

Is it possible to truncate the digits after decimal point in Metapost
when using textext()? Please see the minimal example below which
produces 1.84375. Can I just keep the first digit and have it produce
1.8 ?


Here is a helper macro for you:

def trunc_digits(expr n, origs) =
  hide(
string s, tmp;
numeric ii, e;
e := -1;
for i=1 upto length(origs):
  ii := i;
  tmp := substring (i-1,i) of origs;
  if tmp = .: if n=0: ii:=ii-1; exitif true; fi e:=0; fi
  if e=0: e := e+1; exitif en;  fi
endfor;
s:=substring(0,ii) of origs; )
  s
enddef;


When run this macro with the result of decimal() as second argument,
it will create a new string as many fractional digits as you specify
in the first argument:

  label.lft(textext(trunc_digits(1,decimal f(5))),(0,f(5)) scaled u);   

Best wishes,
Taco
___
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
___


Re: [NTG-context] Metapost label - Truncating digits after decimal point

2009-11-29 Thread Curiouslearn
Thanks so much, Taco. I will try out the code below. Good to know that
Metapost has functions such as substring.




On Sun, Nov 29, 2009 at 3:32 AM, Taco Hoekwater t...@elvenkind.com wrote:
 Curiouslearn wrote:

 Hi,

 Is it possible to truncate the digits after decimal point in Metapost
 when using textext()? Please see the minimal example below which
 produces 1.84375. Can I just keep the first digit and have it produce
 1.8 ?

 Here is a helper macro for you:

 def trunc_digits(expr n, origs) =
  hide(
    string s, tmp;
    numeric ii, e;
    e := -1;
    for i=1 upto length(origs):
      ii := i;
      tmp := substring (i-1,i) of origs;
      if tmp = .: if n=0: ii:=ii-1; exitif true; fi e:=0; fi
      if e=0: e := e+1; exitif en;  fi
    endfor;
    s:=substring(0,ii) of origs; )
  s
 enddef;


 When run this macro with the result of decimal() as second argument,
 it will create a new string as many fractional digits as you specify
 in the first argument:

  label.lft(textext(trunc_digits(1,decimal f(5))),(0,f(5)) scaled u);

 Best wishes,
 Taco
 ___
 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
 ___

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


[NTG-context] Metapost label - Truncating digits after decimal point

2009-11-28 Thread Curiouslearn
Hi,

Is it possible to truncate the digits after decimal point in Metapost
when using textext()? Please see the minimal example below which
produces 1.84375. Can I just keep the first digit and have it produce
1.8 ?

Thanks.

\setuppapersize[letter][letter]

\setupcolors[state=start]


\starttext

\startuseMPgraphic{Figure}
u := 1cm;
pickup pencircle scaled 2pt; % default pen thickness
%TheFunction
vardef f(expr x) =
(10/x)-x*((0.5)**x)
enddef;
%Labels 
label.lft(textext(decimal f(5)),(0,f(5)) scaled u); 
\stopuseMPgraphic
\useMPgraphic{Figure}

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


Re: [NTG-context] Problem with \digits

2009-09-08 Thread Hans Hagen

Flavien Lambert wrote:

Dear all, I tried to compile some of my old files with the latest minimals
(MKIV) but encountered the error described below. Is there any way to use
the digit macro with MKIV ?
Regards,


i'll send you a patched file


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 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
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Problem with \digits

2009-09-07 Thread Flavien Lambert
Dear all, I tried to compile some of my old files with the latest minimals
(MKIV) but encountered the error described below. Is there any way to use
the digit macro with MKIV ?
Regards,

2009/6/16 richard.steph...@converteam.com


 Hello,

 I am using mkiv beta (14-Jun-09) and the \digits command does not like the
 decimal point. Any suggestions?
 Test code and log file follow:

 Richard

 Test code
 \starttext
 \digits{1.6}
 \stoptext

 Log file
 This is LuaTeX, Version beta-0.40.5-2009061023 (Web2C 2009)
  \write18 enabled.
 (testdigits.tex
 color   : system all is global activated
 color   : system gray is global activated
 color   : mpcmyk color space is supported
 color   : mpspot color space is supported
 color   : system rgb is global activated
 color   : system all is global activated

 ConTeXt  ver: 2009.06.14 21:01 MKIV  fmt: 2009.6.16  int: english/english

 system  : cont-new loaded
 (C:/Tools/context/texmf-context/tex/context/base/cont-new.tex
 systems : beware: some patches loaded from cont-new.tex
 (C:/Tools/context/texmf-context/tex/context/base/cont-new.mkiv)
 (C:/Tools/context/texmf-context/tex/context/base/cont-mtx.tex))
 system  : cont-fil loaded
 (C:/Tools/context/texmf-context/tex/context/base/cont-fil.tex
 loading : ConTeXt File Synonyms
 )
 system  : cont-sys.rme loaded
 (C:/Tools/context/texmf-context/tex/context/user/cont-sys.rme
 (C:/Tools/context/texmf-context/tex/context/base/type-tmf.tex)
 (C:/Tools/context/texmf-context/tex/context/base/type-siz.tex
 (C:/Tools/context/texmf-context/tex/context/base/type-siz.mkiv))
 (C:/Tools/context/texmf-context/tex/context/base/type-otf.tex
 (C:/Tools/context/texmf-context/tex/context/base/type-otf.mkiv)))
 system  : testdigits.top loaded
 (testdigits.top)
 fonts   : preloading latin modern fonts
 bodyfont: 12pt rm is loaded
 language: language en is active
 systems : begin file testdigits at line 1
 ! \textfont1 is undefined (character 58).
 \mathematics #1-\relax \ifmmode #1\else $#1$
 \fi
 \doscandigit ...\digitoutputmode ,\else .\fi \fi }
  \egroup
 \digitsep ...x \digitsepbox \hbox {\doscandigit #1
  }\fi \chardef \skipdigit
 0...
 \scandigits #1-\if #1.\digitsep 1
  \else \if #1,\digitsep 2\else \if
 #...@\digi...
 \dodohandletokenstwo *#1-\dododohandletokens {#1}
  \dohandletokens
 argument 1.
 6
 ...
 l.2 \digits{1.6}

 ?



 Converteam UK Ltd. Registration Number: 5571739 and Converteam Ltd.
 Registration Number: 2416188
 Registered in England and Wales.
 Registered office: Boughton Road, Rugby, Warwickshire, CV21 1BU.

 CONFIDENTIALITY : This e-mail and any attachments are confidential and may
 be privileged. If you are not a named recipient, please notify the sender
 immediately and do not disclose the contents to another person, use it for
 any purpose or store or copy the information in any medium.

 Please consider the environment before printing this e-mail

 ___
 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  : https://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net

 ___




-- 
Flavien.

Quantum objects are completely crazy but, at least, they are all crazy in
the same way. R.P. Feynman.
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Problem with \digits

2009-06-18 Thread richard . stephens
 I am using mkiv beta (14-Jun-09) and the \digits command does not like
the
 decimal point. Any suggestions?

 a lpeg grammar ?

 --
 luigi

I'm sorry, I don't understand.
Does anybody else have this problem, or is it just me?

Richard



Converteam UK Ltd. Registration Number: 5571739 and Converteam Ltd. 
Registration Number: 2416188  
Registered in England and Wales.  
Registered office: Boughton Road, Rugby, Warwickshire, CV21 1BU.  

CONFIDENTIALITY : This e-mail and any attachments are confidential and may be 
privileged. If you are not a named recipient, please notify the sender 
immediately and do not disclose the contents to another person, use it for any 
purpose or store or copy the information in any medium.  

Please consider the environment before printing this e-mail 
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Problem with \digits

2009-06-18 Thread luigi scarso
On Thu, Jun 18, 2009 at 10:06 AM, richard.steph...@converteam.com wrote:

  I am using mkiv beta (14-Jun-09) and the \digits command does not like
 the
  decimal point. Any suggestions?

  a lpeg grammar ?
 
  --
  luigi

 I'm sorry, I don't understand.

lpeg is  parsing expression gramma , a tool like regular expressions  but
more powerful
(see ttp://www.inf.puc-rio.br/~roberto/lpeg/)
and is included in context mkiv (so it works only with  luatex ) ;
see l-lpeg.lua  .
For an example see l-number.lua  (I hope , I have an old mkiv release) .



Does anybody else have this problem, or is it just me?

Can you post a little snippet of your problem ?

-- 
luigi
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Problem with \digits

2009-06-18 Thread luigi scarso
On Thu, Jun 18, 2009 at 10:06 AM, richard.steph...@converteam.com wrote:

  I am using mkiv beta (14-Jun-09) and the \digits command does not like
 the
  decimal point. Any suggestions?

  a lpeg grammar ?
 
  --
  luigi

 I'm sorry, I don't understand.

lpeg is  parsing expression gramma , a tool like regular expressions  but
more powerful
(see ttp://www.inf.puc-rio.br/~roberto/lpeg/)
and is included in context mkiv (so it works only with  luatex ) ;
see l-lpeg.lua  .
For an example see l-number.lua  (I hope , I have an old mkiv release) .



Does anybody else have this problem, or is it just me?

Can you post a little snippet of your problem ?

-- 
luigi
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Problem with \digits

2009-06-16 Thread richard . stephens

Hello,

I am using mkiv beta (14-Jun-09) and the \digits command does not like the
decimal point. Any suggestions?
Test code and log file follow:

Richard

Test code
\starttext
\digits{1.6}
\stoptext

Log file
This is LuaTeX, Version beta-0.40.5-2009061023 (Web2C 2009)
 \write18 enabled.
(testdigits.tex
color   : system all is global activated
color   : system gray is global activated
color   : mpcmyk color space is supported
color   : mpspot color space is supported
color   : system rgb is global activated
color   : system all is global activated

ConTeXt  ver: 2009.06.14 21:01 MKIV  fmt: 2009.6.16  int: english/english

system  : cont-new loaded
(C:/Tools/context/texmf-context/tex/context/base/cont-new.tex
systems : beware: some patches loaded from cont-new.tex
(C:/Tools/context/texmf-context/tex/context/base/cont-new.mkiv)
(C:/Tools/context/texmf-context/tex/context/base/cont-mtx.tex))
system  : cont-fil loaded
(C:/Tools/context/texmf-context/tex/context/base/cont-fil.tex
loading : ConTeXt File Synonyms
)
system  : cont-sys.rme loaded
(C:/Tools/context/texmf-context/tex/context/user/cont-sys.rme
(C:/Tools/context/texmf-context/tex/context/base/type-tmf.tex)
(C:/Tools/context/texmf-context/tex/context/base/type-siz.tex
(C:/Tools/context/texmf-context/tex/context/base/type-siz.mkiv))
(C:/Tools/context/texmf-context/tex/context/base/type-otf.tex
(C:/Tools/context/texmf-context/tex/context/base/type-otf.mkiv)))
system  : testdigits.top loaded
(testdigits.top)
fonts   : preloading latin modern fonts
bodyfont: 12pt rm is loaded
language: language en is active
systems : begin file testdigits at line 1
! \textfont1 is undefined (character 58).
\mathematics #1-\relax \ifmmode #1\else $#1$
 \fi
\doscandigit ...\digitoutputmode ,\else .\fi \fi }
  \egroup
\digitsep ...x \digitsepbox \hbox {\doscandigit #1
  }\fi \chardef \skipdigit
0...
\scandigits #1-\if #1.\digitsep 1
  \else \if #1,\digitsep 2\else \if
#...@\digi...
\dodohandletokenstwo *#1-\dododohandletokens {#1}
  \dohandletokens
argument 1.
 6
...
l.2 \digits{1.6}

?



Converteam UK Ltd. Registration Number: 5571739 and Converteam Ltd. 
Registration Number: 2416188  
Registered in England and Wales.  
Registered office: Boughton Road, Rugby, Warwickshire, CV21 1BU.  

CONFIDENTIALITY : This e-mail and any attachments are confidential and may be 
privileged. If you are not a named recipient, please notify the sender 
immediately and do not disclose the contents to another person, use it for any 
purpose or store or copy the information in any medium.  

Please consider the environment before printing this e-mail 
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Problem with \digits

2009-06-16 Thread luigi scarso
On Tue, Jun 16, 2009 at 4:46 PM, richard.steph...@converteam.com wrote:


 Hello,

 I am using mkiv beta (14-Jun-09) and the \digits command does not like the
 decimal point. Any suggestions?

a lpeg grammar ?

-- 
luigi
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \digits

2009-02-24 Thread Wolfgang Schuster
On Sun, Feb 15, 2009 at 5:04 PM, Wolfgang Schuster
schuster.wolfg...@googlemail.com wrote:
 Hi,

 the \digits command cause a error message with the last beta in MkIV.


 % engine=luatex
 \starttext
 \digits{1.000}
 \stoptext


 ! \textfont 1 is undefined (character :).
 \mathematics #1-\relax \ifmmode #1\else $#1$
                                             \fi
 \doscandigit ...\digitoutputmode ,\else .\fi \fi }
                                                  \egroup
 \digitsep ...x \digitsepbox \hbox {\doscandigit #1
                                                  }\fi \chardef \skipdigit
 0...
 \scandigits #1-\if #1.\digitsep 1
                                  \else \if #1,\digitsep 2\else \if
 #...@\digi...
 \next *#1-\dododohandletokens {#1}
                                   \dohandletokens
 argument 1.
             000
 ...
 l.3 \digits{1.000}


 Best regards,
 Wolfgang
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \digits

2009-02-24 Thread Taco Hoekwater

Wolfgang Schuster wrote:

On Sun, Feb 15, 2009 at 5:04 PM, Wolfgang Schuster
schuster.wolfg...@googlemail.com wrote:

Hi,

the \digits command cause a error message with the last beta in MkIV.


This took much more longer than it should. In supp-num.tex, there is
this definition:

\def\dohandledigits
  {\mathcode`\,=013B \mathcode`\.=013A % pretty hard coded
   \expandafter\handletokens\collecteddigits\with\scandigits
   \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}


which is causing the trouble. I assume this is just to move them out of
the way, so replacing the two ones with zeroes probably works (?).

Best wishes,
Taco
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \digits

2009-02-24 Thread Hans Hagen

Taco Hoekwater wrote:

Wolfgang Schuster wrote:

On Sun, Feb 15, 2009 at 5:04 PM, Wolfgang Schuster
schuster.wolfg...@googlemail.com wrote:

Hi,

the \digits command cause a error message with the last beta in MkIV.


This took much more longer than it should. In supp-num.tex, there is
this definition:

\def\dohandledigits
  {\mathcode`\,=013B \mathcode`\.=013A % pretty hard coded
   \expandafter\handletokens\collecteddigits\with\scandigits
   \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}


which is causing the trouble. I assume this is just to move them out of
the way, so replacing the two ones with zeroes probably works (?).


ok, so we need

\startmode[mkiv]

\def\dohandledigits
  {\mathcode`\,=003B \mathcode`\.=003A % pretty hard coded
   \expandafter\handletokens\collecteddigits\with\scandigits
   \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}

\stopmode

\startnotmode[mkiv]

\def\dohandledigits
  {\mathcode`\,=013B \mathcode`\.=013A % pretty hard coded
   \expandafter\handletokens\collecteddigits\with\scandigits
   \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi}

\stopnotmode

it is on my agenda to rewrite digits in lua (we use it at pragma so i 
have a motive)



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 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
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] MkIV \digits bug

2009-02-19 Thread Wolfgang Schuster


Am 15.02.2009 um 17:04 schrieb Wolfgang Schuster:


Hi,

the \digits command cause a error message with the last beta in MkIV.


% engine=luatex
\starttext
\digits{1.000}
\stoptext


! \textfont 1 is undefined (character :).
\mathematics #1-\relax \ifmmode #1\else $#1$
\fi
\doscandigit ...\digitoutputmode ,\else .\fi \fi }
 \egroup
\digitsep ...x \digitsepbox \hbox {\doscandigit #1
 }\fi \chardef  
\skipdigit 0...

\scandigits #1-\if #1.\digitsep 1
 \else \if #1,\digitsep 2\else \if  
#...@\digi...

\next *#1-\dododohandletokens {#1}
  \dohandletokens
argument 1.
000
...
l.3 \digits{1.000}


Best regards,
Wolfgang



___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] MkIV \digits bug

2009-02-15 Thread Wolfgang Schuster

Hi,

the \digits command cause a error message with the last beta in MkIV.


% engine=luatex
\starttext
\digits{1.000}
\stoptext


! \textfont 1 is undefined (character :).
\mathematics #1-\relax \ifmmode #1\else $#1$
 \fi
\doscandigit ...\digitoutputmode ,\else .\fi \fi }
  \egroup
\digitsep ...x \digitsepbox \hbox {\doscandigit #1
  }\fi \chardef  
\skipdigit 0...

\scandigits #1-\if #1.\digitsep 1
  \else \if #1,\digitsep 2\else \if  
#...@\digi...

\next *#1-\dododohandletokens {#1}
   \dohandletokens
argument 1.
 000
...
l.3 \digits{1.000}


Best regards,
Wolfgang

___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Feature request: \digits command

2008-06-25 Thread Flavien Lambert
Dear all, I allow me to use this message for a related topic on the digits
command. I took a look at the manual on the digits command but did not
found a way to cut a number by group of three digits like
the numprint command, e.g. 100 becomes 1 000 000.
With the digits option 3, dots become thinmuskips. I would like to do
something similar but automatically for groups of three digits. For people
who know the numprint package, this is default option with the french
language.
Best regards.
Flavien.
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Feature request: \digits command

2008-06-20 Thread Wolfgang Schuster
On Thu, Jun 19, 2008 at 10:10 PM, Morgan Brassel [EMAIL PROTECTED] wrote:
 Hi everyone,

 The \digits command is really great when it comes to typeset numbers in
 different languages. However, I miss one functionality from the numprint
 package in latex: when you type for example $e-5$, you get 10^{-5} (with
 no dot in front of it).

 Would it be possible to add an option to \digits to reproduce this?

\starttext
\def\digitpowerseparator{10}
\digits{e-5}
\stoptext

http://pragma-ade.com/show-mag-4.htm

Regards
Wolfgang
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Feature request: \digits command

2008-06-20 Thread Morgan Brassel
Thank you, Wolfgang.
I have already read the This Way on your link very carefully.
In fact, I was looking for a solution to have
\digits{e-5} printed as 10^5
\digits{2e-5} printed as 2 . 10^5
Is it possible to do that? to detect if there is a number before the 'e' 
in \digits?

Regards,
Morgan



Wolfgang Schuster a écrit :
 On Thu, Jun 19, 2008 at 10:10 PM, Morgan Brassel [EMAIL PROTECTED] wrote:
   
 Hi everyone,

 The \digits command is really great when it comes to typeset numbers in
 different languages. However, I miss one functionality from the numprint
 package in latex: when you type for example $e-5$, you get 10^{-5} (with
 no dot in front of it).

 Would it be possible to add an option to \digits to reproduce this?
 

 \starttext
 \def\digitpowerseparator{10}
 \digits{e-5}
 \stoptext

 http://pragma-ade.com/show-mag-4.htm

 Regards
 Wolfgang
 ___
 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  : https://foundry.supelec.fr/projects/contextrev/
 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Feature request: \digits command

2008-06-19 Thread Morgan Brassel
Hi everyone,

The \digits command is really great when it comes to typeset numbers in 
different languages. However, I miss one functionality from the numprint 
package in latex: when you type for example $e-5$, you get 10^{-5} (with 
no dot in front of it).

Would it be possible to add an option to \digits to reproduce this?

Best wishes,
Morgan

___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] A new feature for \digits: \digits{e-1}

2008-03-16 Thread Morgan Brassel

Hi everyone,
In LaTeX, the numprint package provides the \numprint command, and is 
pretty useful when typing numbers. It is quite similar to the \digits 
ConTeXt command.
However, the two commands differ when it comes to this example:
\numprint{e-1}
\digits e-1

In this case, the \numprint command ommits the \cdot in front of the 
1O^-1, whereas \digits does not.

My question is: is it a deliberate choice?
If not, would it be possible to modify the \digits command in order to 
reproduce the behavior of \numprint?

Best wishes,
Morgan
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] problem with \digits + one more...

2005-03-18 Thread Hans Hagen
Martin Kolaøík wrote:
But I have found the next problem:
\starttext
\setupTABLE[column][1][aligncharacter=yes,alignmentcharacter={,},width=5cm,align=middle]
\bTABLE
  \bTR
\bTD 115,3\eTD
  \eTR
  \bTR
\bTD 11,53\eTD
  \eTR
  \bTR
\bTD 1153,\eTD
  \eTR
\eTABLE
\stoptext
seems like some setting got lost when going low level english:
\long\def\doTBLcharalign#1#2% column data
  {\edef\alignmentclass{#1}%
   \edef\alignmentcharacter{\tbltblalignmentcharacter}%
   \ifcase\TBLpass\or
 \setfirstpasscharacteralign\checkalignment{#2}% {\strut#2\unskip}%
   \fi % force hsize, so always a second
   \setsecondpasscharacteralign \checkalignment{#2}% {\strut#2\unskip}%
   \ignorespaces}
\starttext
\setupTABLE[column][1][aligncharacter=yes,alignmentcharacter={,},width=5cm,align=middle]
\bTABLE
  \bTR
\bTD 115,3 \eTD
  \eTR
  \bTR
\bTD 11,53 \eTD
  \eTR
  \bTR
\bTD 1153, \eTD
  \eTR
\eTABLE
% \starttabulate[|cg{.}|cg{,}|cg{,}|]
% \NC period \NC comma  \NC comma   \NC\NR
% \NG 100.000,00 \NG 100.000,00 \NG 100,00  \NC\NR
% \NG 10.000,00  \NG 10.000,00  \NG 1000,00 \NC\NR
% \NG 100,00 \NG 100,00 \NG 10,00   \NC\NR
% \NG 100,00 \NG 100,00 \NG 10,00   \NC\NR
% \NG 10\\   \NG 10\\   \NG 0,00\NC\NR
% \NG 10 \NG 10 \NG 0,00\NC\NR
% \NG 10 \NG 10 \NG 0,00\NC\NR
% \stoptabulate
\stoptext
-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] problem with \digits

2005-03-17 Thread Hans Hagen
Martin Kolaøík wrote:
Hi all,
I used \digits and this is the result:
=
! Missing $ inserted.
inserted text
$
to be read again
   _
\next ...savedigit \collecteddigits @\else \if #1_
  \savedigit
\collecteddigit...
\doCurrency ...{\thinspace CHF}]\BF \digits #1\AF
  \relax
=
Is this known problem? Something with catcodes, I think,
it works ok here; can you make a test file?
Hans
-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


RE: [NTG-context] problem with \digits + one more...

2005-03-17 Thread Martin Kolaøík
OK,

it works in my office too (context 02.07.) -- so probably there is a problem in 
my home installation.

But I have found the next problem:

\starttext

\setupTABLE[column][1][aligncharacter=yes,alignmentcharacter={,},width=5cm,align=middle]

\bTABLE
  \bTR
\bTD 115,3\eTD
  \eTR
  \bTR
\bTD 11,53\eTD
  \eTR
  \bTR
\bTD 1153,\eTD
  \eTR
\eTABLE

\stoptext

does not align numbers by comma -- should I setup something more?

Thank you,

Martin


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Hans Hagen
Sent: Thursday, March 17, 2005 10:24 AM
To: [EMAIL PROTECTED]; mailing list for ConTeXt users
Subject: Re: [NTG-context] problem with \digits


Martin Kolaøík wrote:
 Hi all,

 I used \digits and this is the result:

 =

 ! Missing $ inserted.
 inserted text
 $
 to be read again
_
 \next ...savedigit \collecteddigits @\else \if #1_
   \savedigit
 \collecteddigit...

 \doCurrency ...{\thinspace CHF}]\BF \digits #1\AF
   \relax

 =

 Is this known problem? Something with catcodes, I think,

it works ok here; can you make a test file?

Hans


-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


smime.p7s
Description: S/MIME cryptographic signature
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] problem with \digits

2005-03-16 Thread Martin Kolaøík
Hi all,

I used \digits and this is the result:

=

! Missing $ inserted.
inserted text
$
to be read again
   _
\next ...savedigit \collecteddigits @\else \if #1_
  \savedigit
\collecteddigit...

\doCurrency ...{\thinspace CHF}]\BF \digits #1\AF
  \relax

=

Is this known problem? Something with catcodes, I think,

have a nice day,

Martin


smime.p7s
Description: S/MIME cryptographic signature
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Re: \digits

2003-09-04 Thread Hans Hagen
At 13:01 01/09/2003 +0200, you wrote:
Hans Hagen [EMAIL PROTECTED] writes:

 \def\scandigits#1%

[...]

 Not that tested -)

Looks fine.

Is there a way to increase the length of the dash in

123,--

Now it looks like a simple -, I'd like to be able to choose between
-, -- and perhaps ---.
you can tweak:

\def\zeroamount{-}
\def\positive  {+}
\def\negative  {-}
-
  Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-
   information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-
___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \digits

2003-09-01 Thread Hans Hagen
At 19:59 29/08/2003 +0200, you wrote:
Hello,

while browsing the source, I came across the very nice \digits
macro.
But I have some comments: In my opinion some characters don't look right

\starttext
\digits 123.222,=  % short, OK
\digits 123.222,== % should be em dash (?)
\digits +123.222,22% OK
\digits -123.222,33% too small
\stoptext
The + and - should be the same size.

Any comments?
\def\scandigits#1%
  {\if#1.\digitsep1\else
   \if#1,\digitsep2\else
   [EMAIL PROTECTED] \else
   \if#1_\digitnop \else
   \if#1/\digitsgn{\hphantom{+}}\chardef\skipdigit0\else
   \if#1-\ifcase\skipdigit\digitsgn-\else 
% \skipdigit instead of 
\digitsepbox
   \box\digitsepbox\digitzeroamount \fi\chardef\skipdigit0\else
   \if#1+\digitsgn+\chardef\skipdigit0\else
   \if#1=\box\digitsepbox\digitzeroamount \chardef\skipdigit0\else
   \if#1s\digitsgn{\hphantom{\positive}}\chardef\skipdigit0\else
   \if#1p\digitsgn\positive\chardef\skipdigit0\else
   \if#1m\digitsgn\negative\chardef\skipdigit0\else
   \if#1n\digitsgn\negative\chardef\skipdigit0\else
 \box\digitsepbox 
#1\chardef\skipdigit0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}

Not that tested -)

Hans
-
  Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-
   information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-
___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] Re: \digits

2003-09-01 Thread Patrick Gundlach
Hans Hagen [EMAIL PROTECTED] writes:


 \def\scandigits#1%


[...]


 Not that tested -)

Looks fine.

Is there a way to increase the length of the dash in 

123,--

Now it looks like a simple -, I'd like to be able to choose between
-, -- and perhaps ---.


Patrick
___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] \digits

2003-08-29 Thread Patrick Gundlach
Hello, 

while browsing the source, I came across the very nice \digits
macro. 

But I have some comments: In my opinion some characters don't look right

\starttext
\digits 123.222,=  % short, OK
\digits 123.222,== % should be em dash (?)
\digits +123.222,22% OK
\digits -123.222,33% too small
\stoptext

The + and - should be the same size. 

Any comments?

Patrick
-- 
Silent is the goldfish in its bowl
___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context