[NTG-context] LMTX, mathcases and noalign

Hans Hagen j.hagen at xs4all.nl
Fri Nov 13 17:06:26 CET 2020

On 11/13/2020 4:21 PM, Jean-Philippe Rey wrote:
> Dear list,
> I am trying to switch from MKIV to LMTX. I've just found a discrepancy with the following code which puts space between two lines in a math alignment. This minimum breaking example uses \startcases, but the same problem arises with other alignment macros.
> \starttext
> \startformula
> \startcases
> \NC 1 \NC if not null \NR
> \noalign{\vskip2ex}
> \NC 0 \NC if null \NR
> \stopcases
> \stopformula
> \stoptext
> This snippet works fine with MKIV but breaks in LMTX (see attached log file). Is this a bug in LMTX or is there another way to insert space between two lines?
> I've already tried different other solutions, but none seems really appropriate:
> - \intertext produces a vertical space of at least 3 lines and I haven't been able to make it smaller;
> - adding an empty line (\NC \NR) produces a smaller space but I am unable to reduce its height below a minimum value (roughly a line);
> - adding a \vrule to the above or below line works fine but it needs some calculation depending on the content of the line.
we're in the process of upgrading some code in lmtx ... so the next 
upload will provide \TB (as in other tabular like mechanisms)

Actually your code will not work in a recent lmtx. This has to do with 
the fact that a \noalign is always somewhat tricky (relates to the 
engine looking ahead for specific commands). In mkiv (an dolder lmtx) 
there is some \noalign overload magic that deals with that but in recent 
lmtx we use a different approach.


The next code defines a macro \TB that is protected but still acceptable 
for alignment lookahead checking with an optional argument and that 
behaves like \blank.


\NC 1 \NC if not null \NR
\NC 0 \NC if null \NR
\NC 0 \NC if null \NR


(There is a little more involved because we want to protect commands 
like \TB against overloading while at the same time we do overload them 
in all those different table mechanisms but this is not something users 
have to worry about.)

Btw, using \noalign is to be avoided because it assumes that the 
mechanism uses the alignment mechanism.

But best wait for the next upload.


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the ntg-context mailing list