* LMTX, mathcases and noalign
@ 2020-11-13 15:21 Jean-Philippe Rey
2020-11-13 16:06 ` Hans Hagen
0 siblings, 1 reply; 2+ messages in thread
From: Jean-Philippe Rey @ 2020-11-13 15:21 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]
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.
Thank you for your help,
--
Jean-Philippe Rey
jean-philippe.rey@centralesupelec.fr
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
[-- Attachment #2: noalign-mfe.log --]
[-- Type: application/octet-stream, Size: 1797 bytes --]
open source > level 1, order 1, name 'cont-yes.mkiv'
system >
system > ConTeXt ver: 2020.11.08 12:42 LMTX fmt: 2020.11.13 int: english/english
system >
system > 'cont-new.mkiv' loaded
open source > level 2, order 2, name '/Users/jprey/Applications/ConTeXt/2020-11-09/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system > beware: some patches loaded from cont-new.mkiv
close source > level 2, order 2, name '/Users/jprey/Applications/ConTeXt/2020-11-09/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system > files > jobname 'noalign-mfe', input './noalign-mfe', result 'noalign-mfe'
fonts > latin modern fonts are not preloaded
languages > language 'en' is active
open source > level 2, order 3, name './noalign-mfe.tex'
fonts > preloading latin modern fonts (second stage)
fonts > 'fallback modern-designsize rm 12pt' is loaded
tex error > tex error on line 5 in file ./noalign-mfe.tex: Misplaced \crcr
<macro> \math_cases_NR [#1][#2]->\strc_formulas_place_number_nested {#1}{#2}\crcr
<macro> \dodirectdoubleempty ...\expandafter \syst_helpers_direct_double_empty_one_yes \else \expandafter \syst_helpers_direct_double_empty_one_nop \fi #1
#2
<template> \stopimath
\endtemplate
<line 4.5> \noalign
{\vskip2ex}
1 \starttext
2 \startformula
3 \startcases
4 \NC 1 \NC if not null \NR
5 >> \noalign{\vskip2ex}
6 \NC 0 \NC if null \NR
7 \stopcases
8 \stopformula
9 \stoptext
10
I can't figure out why you would want to use a tab mark or \cr or \span just
now. If something like a right brace up above has ended a previous alignment
prematurely, you're probably due for more error messages.
[-- Attachment #3: noalign-mfe-error.log --]
[-- Type: application/octet-stream, Size: 790 bytes --]
return {
["errortype"]=0,
["filename"]="./noalign-mfe.tex",
["lastcontext"]="\n<macro> \\math_cases_NR [#1][#2]->\\strc_formulas_place_number_nested {#1}{#2}\\crcr \n \n<macro> \\dodirectdoubleempty ...\\expandafter \\syst_helpers_direct_double_empty_one_yes \\else \\expandafter \\syst_helpers_direct_double_empty_one_nop \\fi #1\n #2\n<template> \\stopimath \n \\endtemplate \n\n<line 4.5> \\noalign\n {\\vskip2ex}",
["lastluaerror"]="?",
["lasttexerror"]="Misplaced \\crcr",
["lasttexhelp"]="I can't figure out why you would want to use a tab mark or \\cr or \\span just\nnow. If something like a right brace up above has ended a previous alignment\nprematurely, you're probably due for more error messages.",
["linenumber"]=5,
["offset"]=10,
["skiplinenumber"]=5,
}
[-- Attachment #4: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: LMTX, mathcases and noalign
2020-11-13 15:21 LMTX, mathcases and noalign Jean-Philippe Rey
@ 2020-11-13 16:06 ` Hans Hagen
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2020-11-13 16:06 UTC (permalink / raw)
To: mailing list for ConTeXt users, Jean-Philippe Rey
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-13 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 15:21 LMTX, mathcases and noalign Jean-Philippe Rey
2020-11-13 16:06 ` Hans Hagen
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).