Re: [NTG-context] [OT] intelligent commas in math (in LaTeX)

2011-10-01 Thread luigi scarso
On Sat, Oct 1, 2011 at 4:12 AM, Aditya Mahajan adit...@umich.edu wrote:
 In principle a cleaner implementation is possible in luatex (without
 using
 active characters), but I am not completely sure about this. It will be
 better to handle this as part of \mnum macro.

 Hm, can you explain this a bit ?

 Currently ConTeXt already checks if '.' is part of a complete number or not
 as part of the export macros. For example:

 \m{x + 1.25y = 3.5}

 exports as

  m:math
 display=inlinem:mrowm:mi푥/m:mim:mo+/m:mom:mn1.25/m:mnm:mi푦/m:mim:mo=/m:mom:mn3.5/m:mn/m:mrow/m:math

 Notice that 1.25 is part of a single m:mn tag.

 In contrast, if you use comma as a math delimiter, then the export function
 does not recognize the number correctly.

 \m{x + 1,25y = 3.5}

 exports as

  m:math
 display=inlinem:mrowm:mi푥/m:mim:mo+/m:mom:mn1/m:mnm:mo,/m:mom:mn25/m:mnm:mi푦/m:mim:mo=/m:mom:mn3/m:mnm:mo,/m:mom:mn5/m:mn/m:mrow/m:math

 However, we do have a \mn macro (math number) to tag numbers. So you can
 type

 \m{x + \mn{1,25}y = \mn{3,5}}

 which exports as

  m:math
 display=inlinem:mrowm:mi푥/m:mim:mo+/m:mom:mn1,25/m:mnm:mi푦/m:mim:mo=/m:mom:mn3,5/m:mn/m:mrow/m:math


 So, if we want to recognize ',' as a decimal separator, two solutions are
 possible in MkIV. The first is to build upon the existing export code that
 recognizes '.' as a decimal separator (to figure out the contents of the
 mn tag) to also recognize ',' as a decimal separator;

 The drawback of such an approach is that if you are in the habit of not
 adding a space after a comma, for example writing Let $\naturalnumbers$
 denote the set $\{1,2,3,\dots\}$ of natural numbers... then you will get
 wrong output.

 So, an alternative option is to ask the user to tag all numbers with \mn.
 Then, the \mn{...} macro can redefine the comma so that the spaces around it
 match its use as a decimal separator.

 Aditya

ok


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

Re: [NTG-context] [OT] intelligent commas in math (in LaTeX)

2011-09-30 Thread luigi scarso
On Thu, Sep 29, 2011 at 6:15 PM, Aditya Mahajan adit...@umich.edu wrote:
 On Mon, 26 Sep 2011, Mojca Miklavec wrote:

 http://tug.org/pracjourn/2011-1/beccari.html

 Short summary: This allows the comma in  $1, 2, 3$ to be have as punctuation
 comma (similar to \setupmathematics[autopunct=no]) and
 $1,23$ to behave as decimal comma (similar to
 \setupmatematics[autopunct=yes]). Since it is targeting pdftex and xetex
 engines, it makes , an active char in mathmode and redefines it as a macro
 that uses look ahead to check if the next token is a digit.

 In principle a cleaner implementation is possible in luatex (without using
 active characters), but I am not completely sure about this. It will be
 better to handle this as part of \mnum macro.

 Aditya
Hm, can you explain this a bit ?

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

Re: [NTG-context] [OT] intelligent commas in math (in LaTeX)

2011-09-30 Thread Philipp A.
that would be very useful for sets and german decimals: $x = 1,33$ vs. $x ∈
{1, 2, 3, 4}$
___
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] [OT] intelligent commas in math (in LaTeX)

2011-09-30 Thread Aditya Mahajan

In principle a cleaner implementation is possible in luatex (without using
active characters), but I am not completely sure about this. It will be
better to handle this as part of \mnum macro.


Hm, can you explain this a bit ?


Currently ConTeXt already checks if '.' is part of a complete number or 
not as part of the export macros. For example:


\m{x + 1.25y = 3.5}

exports as

  m:math 
display=inlinem:mrowm:mi푥/m:mim:mo+/m:mom:mn1.25/m:mnm:mi푦/m:mim:mo=/m:mom:mn3.5/m:mn/m:mrow/m:math


Notice that 1.25 is part of a single m:mn tag.

In contrast, if you use comma as a math delimiter, then the export 
function does not recognize the number correctly.


\m{x + 1,25y = 3.5}

exports as

  m:math 
display=inlinem:mrowm:mi푥/m:mim:mo+/m:mom:mn1/m:mnm:mo,/m:mom:mn25/m:mnm:mi푦/m:mim:mo=/m:mom:mn3/m:mnm:mo,/m:mom:mn5/m:mn/m:mrow/m:math


However, we do have a \mn macro (math number) to tag numbers. So you can 
type


\m{x + \mn{1,25}y = \mn{3,5}}

which exports as

  m:math 
display=inlinem:mrowm:mi푥/m:mim:mo+/m:mom:mn1,25/m:mnm:mi푦/m:mim:mo=/m:mom:mn3,5/m:mn/m:mrow/m:math



So, if we want to recognize ',' as a decimal separator, two solutions are 
possible in MkIV. The first is to build upon the existing export code that 
recognizes '.' as a decimal separator (to figure out the contents of the 
mn tag) to also recognize ',' as a decimal separator;


The drawback of such an approach is that if you are in the habit of not 
adding a space after a comma, for example writing Let $\naturalnumbers$ 
denote the set $\{1,2,3,\dots\}$ of natural numbers... then you will get 
wrong output.


So, an alternative option is to ask the user to tag all numbers with \mn. 
Then, the \mn{...} macro can redefine the comma so that the spaces around 
it match its use as a decimal separator.


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] [OT] intelligent commas in math (in LaTeX)

2011-09-29 Thread Aditya Mahajan

On Mon, 26 Sep 2011, Mojca Miklavec wrote:


http://tug.org/pracjourn/2011-1/beccari.html


Short summary: This allows the comma in  $1, 2, 3$ to be have as 
punctuation comma (similar to \setupmathematics[autopunct=no]) and
$1,23$ to behave as decimal comma (similar to 
\setupmatematics[autopunct=yes]). Since it is targeting pdftex and xetex 
engines, it makes , an active char in mathmode and redefines it as a macro 
that uses look ahead to check if the next token is a digit.


In principle a cleaner implementation is possible in luatex (without using 
active characters), but I am not completely sure about this. It will be 
better to handle this as part of \mnum macro.


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
___


[NTG-context] [OT] intelligent commas in math (in LaTeX)

2011-09-26 Thread Mojca Miklavec
http://tug.org/pracjourn/2011-1/beccari.html
___
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
___