From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr>
Subject: Re: LMTX, mathcases and noalign
Date: Fri, 13 Nov 2020 17:06:26 +0100 [thread overview]
Message-ID: <b700a257-f394-3f7a-a2cf-9329130372d3@xs4all.nl> (raw)
In-Reply-To: <B56D0711-15A7-4CBF-BE7E-B2C89CFC6969@centralesupelec.fr>
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.
\starttext
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.
\pushoverloadmode
\noaligned\tolerant\protected\def\TB[#1]{\noalign{\blank[#1]}}
\popoverloadmode
\startformula
\startcases
\NC 1 \NC if not null \NR
\TB[2ex]
\NC 0 \NC if null \NR
\TB[4*big]
\NC 0 \NC if null \NR
\stopcases
\stopformula
\stoptext
(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
-----------------------------------------------------------------
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
___________________________________________________________________________________
prev parent reply other threads:[~2020-11-13 16:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 15:21 Jean-Philippe Rey
2020-11-13 16:06 ` Hans Hagen [this message]
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=b700a257-f394-3f7a-a2cf-9329130372d3@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=jean-philippe.rey@centralesupelec.fr \
--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).