ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Otared Kavian <otared@gmail.com>
Subject: Re: mathmatrix and internal lines
Date: Thu, 26 Nov 2020 23:23:57 +0100	[thread overview]
Message-ID: <2e62e93d-6736-2e6f-6e8b-05c112cadf74@xs4all.nl> (raw)
In-Reply-To: <2201965F-382F-495F-AE59-A2CB23815544@gmail.com>

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
   <command that picks up [#1]

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
-----------------------------------------------------------------
___________________________________________________________________________________
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-11-26 22:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26  9:19 Jean-Philippe Rey
2020-11-26  9:58 ` Otared Kavian
2020-11-26 12:40 ` Otared Kavian
2020-11-26 18:46   ` Jean-Philippe Rey
2020-11-26 19:43     ` Otared Kavian
2020-11-26 22:23       ` Hans Hagen [this message]
2020-11-27  9:07         ` Otared Kavian
2020-11-27  9:19           ` Hans Hagen
2020-11-29  7:48         ` Otared Kavian
2020-11-29 18:59           ` Jean-Philippe Rey
2020-11-29 20:01             ` Otared Kavian
2020-11-30  8:14           ` Taco Hoekwater

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=2e62e93d-6736-2e6f-6e8b-05c112cadf74@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=otared@gmail.com \
    /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).