On 3/17/2020 10:08 AM, Henri Menke wrote:
Dear list,

Sorry for the stupid title, I couldn't resist. :-)

LuaTeX has the option to adjust spacing between different classes of
math atoms.  However, looking in the TeXbook, page 170, in the table for
spacings between adjacent atoms, we find that some of those spacing are
undefined (* in the table) and therefore, when TeX encounters this
combination, spacing is just skipped.

This also translates to the parameters in LuaTeX.  For example the
combination Open-Bin is skipped by TeX and therefore setting the
corresponding parameter just does nothing.

\Umathordrelspacing\textstyle=50mu
\Umathopenbinspacing\textstyle=50mu
$a = (-2)$
\bye

So my question is, what is the point of the parameters that describe
these skipped combinations?  Shouldn't they just be deleted?
Alternatively, they could actually be implemented to do something.

When that system was set up we decided to keep these 'unused slots' becauseit makes the code nicer and also prevents errors in case one decided to implement some matrix like approach to settings. Making the engine bark on them would be comparable silly as having the empty slots that we now have in some unicode math alphabets (which forces all programs that do something with them to deal with the exceptions).

Anyway, these parameters have their limitations anyway. Say that we have this:

\def\whatevera
  {\Umathordrelspacing \textstyle=50mu
   \Umathopenbinspacing\textstyle=50mu}

\def\whateverb
  {\Umathordrelspacing \textstyle=25mu
   \Umathopenbinspacing\textstyle=25mu}

$\whatevera a = (-2)$

$\whateverb a = (-2)$

$ {\whatevera a = (-2)}\quad
  {\whateverb a = (-2)}\quad
  {\whatevera a = (-2)}
$

I presume that you can predict what you get given your question.
Now, to come to your question / remark, it is trivial to introduce a parameters, say \mathspacingmode, that obeys these spacing options (apart from possible weird side effects) but they are global.

However, in luametatex we can do this:

\def\whatevera
  {\frozen\Umathordrelspacing \textstyle=50mu
   \frozen\Umathopenbinspacing\textstyle=50mu}

\def\whateverb
  {\frozen\Umathordrelspacing \textstyle=25mu
   \frozen\Umathopenbinspacing\textstyle=25mu}

$\whatevera a = (-2)$

$\whateverb a = (-2)$

$ {\whatevera a = (-2)}\quad
  {\whateverb a = (-2)}\quad
  {\whatevera a = (-2)}
$

Read: we can save the state of parameters. So, as a quick and dirty experiment I added a feature that controls the spacing, think of:

$ {\whatevera a = ( -2)}\quad
  {\whateverb\frozen\Umathspacingmode\textstyle1 a = (-2)}\quad
  {\whatevera\frozen\Umathspacingmode\textstyle1 a = (-2)}
$

But ... the mentioned \frozen parameter feature is experimental and awaiting decisions / comments / suggestions of usefullness by Aditya, who has no time, so no hurry with that. After all, given the always acclaimed perfect math in tex (okay, according to some persistent naratives, context can't do math) all such extensions are debatable anyway.

One tricky part of these spacing issues is that these get applied selectively based on what goes left or right as well as circumstances. There's always the danger of 'fixing' this and a while later 'getting complains about some edge case that fails'. Which (I think) is why tex plays safe and assumes an occasional injected user space.

There are a few more edge cases with spacing but for now I leave these to your imagination.

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to