ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Alan BRASLAU <alan.braslau@cea.fr>
To: Aditya Mahajan <adityam@umich.edu>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: strange output in math display mode
Date: Tue, 22 Dec 2015 19:19:12 -0700	[thread overview]
Message-ID: <20151222191912.75be3c6c@cea.fr> (raw)
In-Reply-To: <alpine.LNX.2.20.1512221717560.23294@ybpnyubfg.ybpnyqbznva>

So it it a TeX programming limitation.

The risk of leading to an exponential number of branches is addressed
by Knuth at the beginning of Chapter 17 of the TeXbook (p. 139):
"Mathematicians tend to \quote{overuse} \over when they first begin to
typeset their own work on a system like \TEX." ...

At one point, I went back to using \over rather than \frac as the later
was broken and gave no output. This has since been fixed, but I stayed
with \over as I find primary operators to be much more elegant syntax
than multiple argument macros. It is too bad that luatex does not
employ a better programming solution, as the use of \frac{}{} leads to
ugly mathematical source code.

I guess that I should not worry about it too much since, as Knuth points
out in Chapter 17, overuse of \over, etc. leads to ugly results
anyways, just as well as an overuse of \text in mathematical formulas
(as we physicists tend to abuse) also leads to ugly mathematics.

Alan


On Tue, 22 Dec 2015 17:30:22 -0500
Aditya Mahajan <adityam@umich.edu> wrote:

> On Tue, 22 Dec 2015, Alan BRASLAU wrote:
> 
> > Wolfgang,
> >
> > Can you explain to us why it should be preferable for ConTeXt users
> > to employ \frac12 rather than the native TeX construction {1\over
> > 2}? I understand that the macro \frac does some additional trickery
> > but the two constructions should *always* yield identical results
> > (when keyed-in properly).  
> 
> One of the troubles with { .... \over ...} and the like is that TeX
> does not know which "style" to use. This can lead to extra processing
> when using any command defined using \mathpalatte (such as \text,
> stacked arrows, and others).
> 
> Consider \text{...}. Basically, we want \text{...} to typeset it's 
> argument in a \hbox with textsize equal to the normalsize in normal
> mode and equal to script size when used in a subscript and in
> scriptsciptsize when used in a sub-subscript. Now, in traditional
> tex, when parsing
> 
>     {\text{hello} \over 2}
> 
> TeX does not kow what size to use for \text{...} until it encounters
> the \over. So, when parsing \text{hello}, TeX generates all possible
> sizes and then prunes them later on. With nested constructs like
> 
> {\text{hello}_{\text{world} \over 2} \over 2}
> 
> it can lead to exponential number of branches.
> 
> With \frac{\text{hello}}{2}, TeX "knows" what style to use for the 
> arguments. So, extra processing is not needed (at least, this is the
> idea in LuaTeX; in PDFTeX, multiple sizes need to be generated). This
> can lead to some slightly faster processing.
> 
> Also see http://tex.stackexchange.com/a/1261/ answer from Taco.
> Contrast the definition of \cramped given there from one in the LaTeX
> mathtools package 
> (http://ctan.bppro.ca/macros/latex/contrib/mathtools/mathtools.dtx) 
> [search from MT_cramped_clap_internal:Nn]
> 
> 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
> ___________________________________________________________________________________


-- 
Alan Braslau
CEA DSM-IRAMIS-SPEC
CNRS UMR 3680
Orme des Merisiers
91191 Gif-sur-Yvette cedex FRANCE
tel: +33 1 69 08 73 15
fax: +33 1 69 08 87 86
mailto:alan.braslau@cea.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
___________________________________________________________________________________

  reply	other threads:[~2015-12-23  2:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 13:01 Jeong Dal
2015-12-21 13:14 ` Otared Kavian
2015-12-21 14:17   ` Wolfgang Schuster
2015-12-22 19:24     ` Alan BRASLAU
2015-12-22 22:30       ` Aditya Mahajan
2015-12-23  2:19         ` Alan BRASLAU [this message]
2015-12-23  9:17           ` Hans Hagen
2015-12-23 15:16             ` Wolfgang Schuster
2015-12-23  9:13         ` Hans Hagen
2015-12-23 15:52       ` Hans Hagen
2015-12-23 18:04         ` Alan BRASLAU

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=20151222191912.75be3c6c@cea.fr \
    --to=alan.braslau@cea.fr \
    --cc=adityam@umich.edu \
    --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).