[NTG-context] Difficulties with \startformula

Hans Hagen pragma at wxs.nl
Tue Jan 14 18:36:38 CET 2014

On 1/14/2014 12:13 AM, Elspeth McGullicuddy wrote:
> Hi,
> 1- I put here a far too long example to show difficulties that I have
> with formulas in conjunction with framed:
> I haven't find a way to insert a formula (displaystyle, vertical
> mode), at the beginning of a \framed.

Here is a small example:


     \hbox{$ x+y $}

If you look in the pdf file you will see the following:

/FontBBox    [-1042 -3060 4082 3560]
/Ascent      3560
/CapHeight   683
/Descent     -3060
/ItalicAngle 0
/StemV       93
/XHeight     431

The less clever viewer can use that information for the selection 
dimensions. Acrobat instead uses the glyph properties.

If you run instead

     \hbox{$$ x+y $$}

you will not get math at all because the $$ == an empty inline math so 
there a text font is used:

/FontBBox    [-422 -280 1394 1127]
/Ascent      1127
/CapHeight   683
/Descent     -280
/ItalicAngle 0
/StemV       91
/XHeight     431

In context,

     \hbox{\startformula x+y \stopformula}

boils down to

   \hbox{\par $$ x+y $$ \par}

plus some more so i decided to turn this into

\hbox{\par \Ustartdisplaymath x+y \Ustopdisplaymath \par}

Now, believe it it not, when I tested that one luatex crashed as we 
never thought about the fact that $$ is catched in the main loop and 
\Ustartdisplaymath falls through and creates havoc. So, after some 
debugging Luigi and I figured out that this was too messy to catch. Math 
magician Taco will fix it in luatex's parser part. So, be warned, don't 
this this trickery now.

In the meantime, i fixed context to deal with such matters. Of course 
that bug doesn't relate to your observations.


                                           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

More information about the ntg-context mailing list