ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: luigi scarso <luigi.scarso@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: [OT] intelligent commas in math (in LaTeX)
Date: Sat, 1 Oct 2011 08:16:22 +0200	[thread overview]
Message-ID: <CAG5iGsDO3jW77GJhPnVXF1HvXShUGPRU-w8mDtEWHyFTQT=rFw@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.02.1109302159350.26779@ybpnyubfg.ybpnyqbznva>

On Sat, Oct 1, 2011 at 4:12 AM, Aditya Mahajan <adityam@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="inline"><m:mrow><m:mi>𝑥</m:mi><m:mo>+</m:mo><m:mn>1.25</m:mn><m:mi>𝑦</m:mi><m:mo>=</m:mo><m:mn>3.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="inline"><m:mrow><m:mi>𝑥</m:mi><m:mo>+</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>25</m:mn><m:mi>𝑦</m:mi><m:mo>=</m:mo><m:mn>3</m:mn><m:mo>,</m:mo><m:mn>5</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="inline"><m:mrow><m:mi>𝑥</m:mi><m:mo>+</m:mo><m:mn>1,25</m:mn><m:mi>𝑦</m:mi><m:mo>=</m:mo><m:mn>3,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
___________________________________________________________________________________

      reply	other threads:[~2011-10-01  6:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-26 20:06 Mojca Miklavec
2011-09-29 16:15 ` Aditya Mahajan
2011-09-30  7:36   ` luigi scarso
2011-09-30  9:04     ` Philipp A.
2011-10-01  2:12     ` Aditya Mahajan
2011-10-01  6:16       ` luigi scarso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG5iGsDO3jW77GJhPnVXF1HvXShUGPRU-w8mDtEWHyFTQT=rFw@mail.gmail.com' \
    --to=luigi.scarso@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).