ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* mathmatrix and internal lines
@ 2020-11-26  9:19 Jean-Philippe Rey
  2020-11-26  9:58 ` Otared Kavian
  2020-11-26 12:40 ` Otared Kavian
  0 siblings, 2 replies; 12+ messages in thread
From: Jean-Philippe Rey @ 2020-11-26  9:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 944 bytes --]

Dear list,

I would like to draw matrices with internal lines as can be done with LaTeX (cf pdf output) :

========================
\documentclass{article}
\begin{document}
$M =\left( \begin{array}{c|c}
A & B \\
\hline
C & D \\
\end{array} \right)$
\end{document}
========================

I didn't find out how to use mathmatrix to achieve this. My best result to date is 

========================
\starttext
$M = \left( \bTABLE[frame=off]
\bTR
	\bTD[rightframe=on, bottomframe=on] $A$ \eTD
	\bTD[bottomframe=on] $B$ \eTD
\eTR\bTR
	\bTD[rightframe=on] $C$ \eTD
	\bTD $D$ \eTD
\eTR
\eTABLE \right)$
\stoptext
========================

The code is rather ugly, and I get a spurious space at the bottom of the table.

Any hints?

Thank you,

-- 
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: blocmatrices-latex.pdf --]
[-- Type: application/pdf, Size: 23989 bytes --]

[-- Attachment #3: blocmatrices-context.pdf --]
[-- Type: application/pdf, Size: 6885 bytes --]

[-- 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] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-26  9:19 mathmatrix and internal lines Jean-Philippe Rey
@ 2020-11-26  9:58 ` Otared Kavian
  2020-11-26 12:40 ` Otared Kavian
  1 sibling, 0 replies; 12+ messages in thread
From: Otared Kavian @ 2020-11-26  9:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Jean-Philippe,

For a simple case like the one you sent, a rather not optimal solution can be this:

\definemathmatrix[mymatrix]
	[left={\left(\,},
	right={\ \right)}]
	
\starttext
\startformula
	\startmymatrix
		\NC A \hskip .5em |\hskip-.5em  \NC B \NR
		\noalign{\hrule}
		\NC C \hskip .5em |\hskip-.5em \NC D \NR
	\stopmymatrix
\stopformula
\stoptext

However I think I have seen sometime ago a more elegant solution, but I could not find it right now…

Best regards: Otared K.

> On 26 Nov 2020, at 10:19, Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr> wrote:
> 
> Dear list,
> 
> I would like to draw matrices with internal lines as can be done with LaTeX (cf pdf output) :
> 
> ========================
> \documentclass{article}
> \begin{document}
> $M =\left( \begin{array}{c|c}
> A & B \\
> \hline
> C & D \\
> \end{array} \right)$
> \end{document}
> ========================
> 
> I didn't find out how to use mathmatrix to achieve this. My best result to date is 
> 
> ========================
> \starttext
> $M = \left( \bTABLE[frame=off]
> \bTR
> 	\bTD[rightframe=on, bottomframe=on] $A$ \eTD
> 	\bTD[bottomframe=on] $B$ \eTD
> \eTR\bTR
> 	\bTD[rightframe=on] $C$ \eTD
> 	\bTD $D$ \eTD
> \eTR
> \eTABLE \right)$
> \stoptext
> ========================
> 
> The code is rather ugly, and I get a spurious space at the bottom of the table.
> 
> Any hints?
> 
> Thank you,
> 
> -- 
> 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
> <blocmatrices-latex.pdf><blocmatrices-context.pdf>___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-26  9:19 mathmatrix and internal lines 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
  1 sibling, 1 reply; 12+ messages in thread
From: Otared Kavian @ 2020-11-26 12:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Jean-Philippe,

The following is better than the one I sent earlier:

\definemathmatrix[mymatrix]
	[left={\left(\,},
	right={\ \right)}]
	
\starttext
\startformula
	\startmymatrix
		\NC A \NC\hskip-.5em \vrule  \NC\hskip-.5em B \NR
		\noalign{\hrule}
		\NC C \NC \hskip-.5em\vrule \NC \hskip-.5em D \NR
	\stopmymatrix
\stopformula
\stoptext

Best regards: Otared K.

> On 26 Nov 2020, at 10:19, Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr> wrote:
> 
> Dear list,
> 
> I would like to draw matrices with internal lines as can be done with LaTeX (cf pdf output) :
> 
> ========================
> \documentclass{article}
> \begin{document}
> $M =\left( \begin{array}{c|c}
> A & B \\
> \hline
> C & D \\
> \end{array} \right)$
> \end{document}
> ========================
> 
> I didn't find out how to use mathmatrix to achieve this. My best result to date is 
> 
> ========================
> \starttext
> $M = \left( \bTABLE[frame=off]
> \bTR
> 	\bTD[rightframe=on, bottomframe=on] $A$ \eTD
> 	\bTD[bottomframe=on] $B$ \eTD
> \eTR\bTR
> 	\bTD[rightframe=on] $C$ \eTD
> 	\bTD $D$ \eTD
> \eTR
> \eTABLE \right)$
> \stoptext
> ========================
> 
> The code is rather ugly, and I get a spurious space at the bottom of the table.
> 
> Any hints?
> 
> Thank you,
> 
> -- 
> 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
> <blocmatrices-latex.pdf><blocmatrices-context.pdf>___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-26 12:40 ` Otared Kavian
@ 2020-11-26 18:46   ` Jean-Philippe Rey
  2020-11-26 19:43     ` Otared Kavian
  0 siblings, 1 reply; 12+ messages in thread
From: Jean-Philippe Rey @ 2020-11-26 18:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3358 bytes --]

Hi Otared,

Thank you very much.

I used your example to write the following macros. They are far from perfect but suit my needs.  A few days ago, Hans warned not to use \noalign in LMTX, so I used the trick he gave to the list even if I don't really understand it.

=== LMTX version ============
%D \macros{HR, VR}
%D \type{\HR} draws a horizontal rule between two rows of a matrix
%D \type{\VR} is used in place of \type{\NC} to draw a vertical rule between two columns of a matrix
%D each macro takes an optional parameter giving the rule dimensions
%D Example
%D  \type{\startmatrix \NC A \VR[depth 2mm] B \NR \HR[height 0.6pt] \NC C \VR D \NR \stopmatrix}
 
\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}
===========================

=== MkIV version ============
%D \macros{HR, VR}
%D \type{\HR} draws a horizontal rule between two rows of a matrix
%D \type{\VR} is used in place of \type{\NC} to draw a vertical rule between two columns of a matrix
%D it takes an optional parameter giving the rule dimensions
%D Example
%D  \type{\startmatrix \NC A \VR[depth 2mm] B \NR \HR \NC C \VR D \NR \stopmatrix}
 
\def\HR{\noalign{\hrule}}

\def\VR{\dosingleempty\doVR}
\def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}
===========================

For the MkIV version I haven't been able to add an optional parameter to \HR the code

\def\HR{\dosingleempty\doHR}
\def\doHR[#1]{\noalign{\hrule #1}}

complains about "Misplaced \noalign"

Best regards,



> Le 26 nov. 2020 à 13:40, Otared Kavian <otared@gmail.com> a écrit :
> 
> Hi Jean-Philippe,
> 
> The following is better than the one I sent earlier:
> 
> \definemathmatrix[mymatrix]
> 	[left={\left(\,},
> 	right={\ \right)}]
> 	
> \starttext
> \startformula
> 	\startmymatrix
> 		\NC A \NC\hskip-.5em \vrule  \NC\hskip-.5em B \NR
> 		\noalign{\hrule}
> 		\NC C \NC \hskip-.5em\vrule \NC \hskip-.5em D \NR
> 	\stopmymatrix
> \stopformula
> \stoptext
> 
> Best regards: Otared K.
> 
>> On 26 Nov 2020, at 10:19, Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr> wrote:
>> 
>> Dear list,
>> 
>> I would like to draw matrices with internal lines as can be done with LaTeX (cf pdf output) :
>> 
>> ========================
>> \documentclass{article}
>> \begin{document}
>> $M =\left( \begin{array}{c|c}
>> A & B \\
>> \hline
>> C & D \\
>> \end{array} \right)$
>> \end{document}
>> ========================
>> 
>> I didn't find out how to use mathmatrix to achieve this. My best result to date is 
>> 
>> ========================
>> \starttext
>> $M = \left( \bTABLE[frame=off]
>> \bTR
>> 	\bTD[rightframe=on, bottomframe=on] $A$ \eTD
>> 	\bTD[bottomframe=on] $B$ \eTD
>> \eTR\bTR
>> 	\bTD[rightframe=on] $C$ \eTD
>> 	\bTD $D$ \eTD
>> \eTR
>> \eTABLE \right)$
>> \stoptext
>> ========================
>> 
>> The code is rather ugly, and I get a spurious space at the bottom of the table.
>> 
>> Any hints?
>> 
>> Thank you,


-- 
Jean-Philippe Rey
jean-philippe.rey@centralesupelec.fr <mailto:jean-philippe.rey@centralesupelec.fr>
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51


[-- Attachment #1.2: Type: text/html, Size: 8990 bytes --]

[-- Attachment #2: 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] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-26 18:46   ` Jean-Philippe Rey
@ 2020-11-26 19:43     ` Otared Kavian
  2020-11-26 22:23       ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Otared Kavian @ 2020-11-26 19:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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…).

%%% 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}

\definemathmatrix[mymatrix]
	[left={\left(\,},
	right={\, \right)}]

\starttext	

\startformula
	\startmymatrix
		\NC A \VR  B \NR
		\HR
		\NC C \VR  D \NR
	\stopmymatrix
\stopformula

\stoptext
%%% end block-matrix.tex

Best regards: Otared K.

> On 26 Nov 2020, at 19:46, Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr> wrote:
> 
> Hi Otared,
> 
> Thank you very much.
> 
> I used your example to write the following macros. They are far from perfect but suit my needs.  A few days ago, Hans warned not to use \noalign in LMTX, so I used the trick he gave to the list even if I don't really understand it.
> 
> === LMTX version ============
> %D \macros{HR, VR}
> %D \type{\HR} draws a horizontal rule between two rows of a matrix
> %D \type{\VR} is used in place of \type{\NC} to draw a vertical rule between two columns of a matrix
> %D each macro takes an optional parameter giving the rule dimensions
> %D Example
> %D  \type{\startmatrix \NC A \VR[depth 2mm] B \NR \HR[height 0.6pt] \NC C \VR D \NR \stopmatrix}
>  
> \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}
> ===========================
> 
> === MkIV version ============
> %D \macros{HR, VR}
> %D \type{\HR} draws a horizontal rule between two rows of a matrix
> %D \type{\VR} is used in place of \type{\NC} to draw a vertical rule between two columns of a matrix
> %D it takes an optional parameter giving the rule dimensions
> %D Example
> %D  \type{\startmatrix \NC A \VR[depth 2mm] B \NR \HR \NC C \VR D \NR \stopmatrix}
>  
> \def\HR{\noalign{\hrule}}
> 
> \def\VR{\dosingleempty\doVR}
> \def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC}
> ===========================
> 
> For the MkIV version I haven't been able to add an optional parameter to \HR the code
> 
> \def\HR{\dosingleempty\doHR}
> \def\doHR[#1]{\noalign{\hrule #1}}
> 
> complains about "Misplaced \noalign"
> 
> Best regards,
> 
> 
> 
>> Le 26 nov. 2020 à 13:40, Otared Kavian <otared@gmail.com> a écrit :
>> 
>> Hi Jean-Philippe,
>> 
>> The following is better than the one I sent earlier:
>> 
>> \definemathmatrix[mymatrix]
>> 	[left={\left(\,},
>> 	right={\ \right)}]
>> 	
>> \starttext
>> \startformula
>> 	\startmymatrix
>> 		\NC A \NC\hskip-.5em \vrule  \NC\hskip-.5em B \NR
>> 		\noalign{\hrule}
>> 		\NC C \NC \hskip-.5em\vrule \NC \hskip-.5em D \NR
>> 	\stopmymatrix
>> \stopformula
>> \stoptext
>> 
>> Best regards: Otared K.
>> 
>>> On 26 Nov 2020, at 10:19, Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr> wrote:
>>> 
>>> Dear list,
>>> 
>>> I would like to draw matrices with internal lines as can be done with LaTeX (cf pdf output) :
>>> 
>>> ========================
>>> \documentclass{article}
>>> \begin{document}
>>> $M =\left( \begin{array}{c|c}
>>> A & B \\
>>> \hline
>>> C & D \\
>>> \end{array} \right)$
>>> \end{document}
>>> ========================
>>> 
>>> I didn't find out how to use mathmatrix to achieve this. My best result to date is 
>>> 
>>> ========================
>>> \starttext
>>> $M = \left( \bTABLE[frame=off]
>>> \bTR
>>> 	\bTD[rightframe=on, bottomframe=on] $A$ \eTD
>>> 	\bTD[bottomframe=on] $B$ \eTD
>>> \eTR\bTR
>>> 	\bTD[rightframe=on] $C$ \eTD
>>> 	\bTD $D$ \eTD
>>> \eTR
>>> \eTABLE \right)$
>>> \stoptext
>>> ========================
>>> 
>>> The code is rather ugly, and I get a spurious space at the bottom of the table.
>>> 
>>> Any hints?
>>> 
>>> Thank you,
> 
> -- 
> 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
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-26 19:43     ` Otared Kavian
@ 2020-11-26 22:23       ` Hans Hagen
  2020-11-27  9:07         ` Otared Kavian
  2020-11-29  7:48         ` Otared Kavian
  0 siblings, 2 replies; 12+ messages in thread
From: Hans Hagen @ 2020-11-26 22:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Otared Kavian

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-26 22:23       ` Hans Hagen
@ 2020-11-27  9:07         ` Otared Kavian
  2020-11-27  9:19           ` Hans Hagen
  2020-11-29  7:48         ` Otared Kavian
  1 sibling, 1 reply; 12+ messages in thread
From: Otared Kavian @ 2020-11-27  9:07 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

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 <j.hagen@xs4all.nl> 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
>  <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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-27  9:07         ` Otared Kavian
@ 2020-11-27  9:19           ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2020-11-27  9:19 UTC (permalink / raw)
  To: Otared Kavian; +Cc: mailing list for ConTeXt users

On 11/27/2020 10:07 AM, Otared Kavian wrote:
> 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 ?
Dunno yet ... it's not that hard but I'm in lmtx mode now.

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] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-26 22:23       ` Hans Hagen
  2020-11-27  9:07         ` Otared Kavian
@ 2020-11-29  7:48         ` Otared Kavian
  2020-11-29 18:59           ` Jean-Philippe Rey
  2020-11-30  8:14           ` Taco Hoekwater
  1 sibling, 2 replies; 12+ messages in thread
From: Otared Kavian @ 2020-11-29  7:48 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 466 bytes --]

> On 26 Nov 2020, at 23:23, Hans Hagen <j.hagen@xs4all.nl> wrote:
> […]
> A bit more code needed but the next upload will have it. Of course you have to wikify it.
> 
> Hans

Hi,
I created a page on the wiki:
	https://wiki.contextgarden.net/Matrix_in_maths <https://wiki.contextgarden.net/Matrix_in_maths>
However the LMTX code is not typeset on the wiki. I'll see with taco whether it is possible to have lmtx mode on the wiki.

Best regards: Otared K.

[-- Attachment #1.2: Type: text/html, Size: 1126 bytes --]

[-- Attachment #2: 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] 12+ messages in thread

* Re: mathmatrix and internal lines
  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
  1 sibling, 1 reply; 12+ messages in thread
From: Jean-Philippe Rey @ 2020-11-29 18:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 911 bytes --]

I added some details and examples to the wiki, however, as you said, they are not typeset correctly.

> Le 29 nov. 2020 à 08:48, Otared Kavian <otared@gmail.com> a écrit :
> 
>> On 26 Nov 2020, at 23:23, Hans Hagen <j.hagen@xs4all.nl <mailto:j.hagen@xs4all.nl>> wrote:
>> […]
>> A bit more code needed but the next upload will have it. Of course you have to wikify it.
>> 
>> Hans
> 
> Hi,
> I created a page on the wiki:
> 	https://wiki.contextgarden.net/Matrix_in_maths <https://wiki.contextgarden.net/Matrix_in_maths>
> However the LMTX code is not typeset on the wiki. I'll see with taco whether it is possible to have lmtx mode on the wiki.
> 
> Best regards: Otared K.

-- 
Jean-Philippe Rey
jean-philippe.rey@centralesupelec.fr <mailto:jean-philippe.rey@centralesupelec.fr>
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51


[-- Attachment #1.2: Type: text/html, Size: 4793 bytes --]

[-- Attachment #2: 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] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-29 18:59           ` Jean-Philippe Rey
@ 2020-11-29 20:01             ` Otared Kavian
  0 siblings, 0 replies; 12+ messages in thread
From: Otared Kavian @ 2020-11-29 20:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1670 bytes --]

Great! Well done. 
I'll ask Taco about LMTX on the wiki.

Best regards: Otared

> On 29 Nov 2020, at 19:59, Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr> wrote:
> 
> I added some details and examples to the wiki, however, as you said, they are not typeset correctly.
> 
>> Le 29 nov. 2020 à 08:48, Otared Kavian <otared@gmail.com <mailto:otared@gmail.com>> a écrit :
>> 
>>> On 26 Nov 2020, at 23:23, Hans Hagen <j.hagen@xs4all.nl <mailto:j.hagen@xs4all.nl>> wrote:
>>> […]
>>> A bit more code needed but the next upload will have it. Of course you have to wikify it.
>>> 
>>> Hans
>> 
>> Hi,
>> I created a page on the wiki:
>> 	https://wiki.contextgarden.net/Matrix_in_maths <https://wiki.contextgarden.net/Matrix_in_maths>
>> However the LMTX code is not typeset on the wiki. I'll see with taco whether it is possible to have lmtx mode on the wiki.
>> 
>> Best regards: Otared K.
> 
> -- 
> Jean-Philippe Rey
> jean-philippe.rey@centralesupelec.fr <mailto:jean-philippe.rey@centralesupelec.fr>
> 91192 Gif-sur-Yvette Cedex - France
> Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 6331 bytes --]

[-- Attachment #2: 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] 12+ messages in thread

* Re: mathmatrix and internal lines
  2020-11-29  7:48         ` Otared Kavian
  2020-11-29 18:59           ` Jean-Philippe Rey
@ 2020-11-30  8:14           ` Taco Hoekwater
  1 sibling, 0 replies; 12+ messages in thread
From: Taco Hoekwater @ 2020-11-30  8:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 29 Nov 2020, at 08:48, Otared Kavian <otared@gmail.com> wrote:
> 
>> On 26 Nov 2020, at 23:23, Hans Hagen <j.hagen@xs4all.nl> wrote:
>> […]
>> A bit more code needed but the next upload will have it. Of course you have to wikify it.
>> 
>> Hans
> 
> Hi,
> I created a page on the wiki:
> 	https://wiki.contextgarden.net/Matrix_in_maths
> However the LMTX code is not typeset on the wiki. I'll see with taco whether it is possible to have lmtx mode on the wiki.

I plan to update the lmtx on the wiki sometime between now and new years’ eve. 
Sorry, I can not be more precise right now.

Best wishes,
Taco
___________________________________________________________________________________
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] 12+ messages in thread

end of thread, other threads:[~2020-11-30  8:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  9:19 mathmatrix and internal lines 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
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

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).