Hi Hans, Thanks for your insight! Indeed I'll wikify what you explained, once I have tested it with the next upload. Would \HL and \VL be also available in mkiv ? Best regards: Otared
On 26 Nov 2020, at 23:23, Hans Hagen
wrote: On 11/26/2020 8:43 PM, Otared Kavian wrote:
Hi Jean-Philippe, A few weeks ago I saw briefly the discussion about Hans' message regarding \noalign and the the new definitions of \HR and \VR that you are sending. Indeed your solution works great ! Just for the case other people may have the same question about writing block matrix, I copy below the whole example which can be found later in the mail archive. (For mkiv, I don't know how to do the same thing…).
The \noaligned permits a \protected definition. Otherwise one has to do something
\def\VR{\noalign\bgroup
that command then does the rule and ends the noalign. Also, that one cannot be \protected (a pitty in case one uses \expanded or so)
So ... a multistep approach. Plenty of that in mkiv.
%%% begin block-matrix.tex % in LMTX defining \HR and \VR to create block matrices: \pushoverloadmode \noaligned\tolerant\protected\def\HR[#1]{\noalign{\hrule #1}} \popoverloadmode \def\VR{\dosingleempty\doVR} \def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}
given the \HR definition that should be
\tolerant\protected\def\VR[#1]{\NC ...\NC}
\definemathmatrix[mymatrix] [left={\left(\,}, right={\, \right)}] \starttext \startformula \startmymatrix \NC A \VR B \NR \HR \NC C \VR D \NR \stopmymatrix \stopformula \stoptext
Anyway, a feature like this should be in sync with other table mechanisms, so
\definemathmatrix [mymatrix] [left={\left\lparent\thinspace}, right={\thinspace\right\rparent}]
\starttext
\startformula \startmymatrix \NC A \VL B \NR \HL \NC C \VL D \NR \stopmymatrix \stopformula
\startformula \startmymatrix \NC A \VL[3,green] B \NR \HL[10,red] \NC C \VL D \NR \stopmymatrix \stopformula
\stoptext
A bit more code needed but the next upload will have it. Of course you have to wikify it.
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 -----------------------------------------------------------------