[NTG-context] strange output in math display mode

Aditya Mahajan adityam at umich.edu
Tue Dec 22 23:30:22 CET 2015

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 
[search from MT_cramped_clap_internal:Nn]


More information about the ntg-context mailing list