ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: ntg-context@ntg.nl
Subject: Re: Ignored spacings are ignored
Date: Tue, 17 Mar 2020 14:54:17 +0100	[thread overview]
Message-ID: <59e37f31-f7c6-39a6-5693-291fe42d903c@xs4all.nl> (raw)
In-Reply-To: <20200317090854.q6vhlwrt5btr22bn@vento15post8>

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	other threads:[~2020-03-17 13:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  9:08 Henri Menke
2020-03-17 13:54 ` Hans Hagen [this message]
2020-03-17 15:52   ` Hans Hagen
2020-03-18 22:13     ` Henri Menke

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=59e37f31-f7c6-39a6-5693-291fe42d903c@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --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).