From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/109678 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean-Philippe Rey Newsgroups: gmane.comp.tex.context Subject: Re: mathmatrix and internal lines Date: Thu, 26 Nov 2020 19:46:53 +0100 Message-ID: <25488D75-D587-4E06-8680-5CBB19508E81@centralesupelec.fr> References: <93D2C0D9-FF37-4281-A95B-AD7D97BE7923@centralesupelec.fr> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Content-Type: multipart/mixed; boundary="===============4396092110471491683==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13720"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Nov 26 19:53:49 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kiMOr-0003TB-9B for gctc-ntg-context-518@m.gmane-mx.org; Thu, 26 Nov 2020 19:53:49 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 85A571AA6DD; Thu, 26 Nov 2020 19:46:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6iAFDlgfE5VJ; Thu, 26 Nov 2020 19:46:56 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 568371AA6EE; Thu, 26 Nov 2020 19:46:56 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id F06DA1AA6DD for ; Thu, 26 Nov 2020 19:46:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4CgQ2NNfVcuW for ; Thu, 26 Nov 2020 19:46:54 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=138.195.33.47; helo=smtp3.ecp.fr; envelope-from=jean-philippe.rey@centralesupelec.fr; receiver= Original-Received: from smtp3.ecp.fr (smtp3.ecp.fr [138.195.33.47]) by zapf.ntg.nl (Postfix) with ESMTP id 49EA51AA6B8 for ; Thu, 26 Nov 2020 19:46:54 +0100 (CET) Original-Received: from [192.168.0.46] (box.vacherie.jprey.fr [78.219.134.10]) (Authenticated sender: jprey) by smtp3.ecp.fr (Postfix) with ESMTPSA id D615561C36; Thu, 26 Nov 2020 19:46:53 +0100 (CET) In-Reply-To: X-Mailer: Apple Mail (2.3608.120.23.2.4) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:109678 Archived-At: --===============4396092110471491683== Content-Type: multipart/alternative; boundary="Apple-Mail=_E748DAAE-F6F7-4641-A14D-0C2BCF7DE037" --Apple-Mail=_E748DAAE-F6F7-4641-A14D-0C2BCF7DE037 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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. =3D=3D=3D LMTX version =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D %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} =20 \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} =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =3D=3D=3D MkIV version =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D %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} =20 \def\HR{\noalign{\hrule}} \def\VR{\dosingleempty\doVR} \def\doVR[#1]{\NC \hskip-0.5em \vrule #1 \hskip-0.5em \NC} =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D 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 =C3=A0 13:40, Otared Kavian a = =C3=A9crit : >=20 > Hi Jean-Philippe, >=20 > The following is better than the one I sent earlier: >=20 > \definemathmatrix[mymatrix] > [left=3D{\left(\,}, > right=3D{\ \right)}] > =09 > \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 >=20 > Best regards: Otared K. >=20 >> On 26 Nov 2020, at 10:19, Jean-Philippe Rey = wrote: >>=20 >> Dear list, >>=20 >> I would like to draw matrices with internal lines as can be done with = LaTeX (cf pdf output) : >>=20 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= >> \documentclass{article} >> \begin{document} >> $M =3D\left( \begin{array}{c|c} >> A & B \\ >> \hline >> C & D \\ >> \end{array} \right)$ >> \end{document} >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= >>=20 >> I didn't find out how to use mathmatrix to achieve this. My best = result to date is=20 >>=20 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= >> \starttext >> $M =3D \left( \bTABLE[frame=3Doff] >> \bTR >> \bTD[rightframe=3Don, bottomframe=3Don] $A$ \eTD >> \bTD[bottomframe=3Don] $B$ \eTD >> \eTR\bTR >> \bTD[rightframe=3Don] $C$ \eTD >> \bTD $D$ \eTD >> \eTR >> \eTABLE \right)$ >> \stoptext >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= >>=20 >> The code is rather ugly, and I get a spurious space at the bottom of = the table. >>=20 >> Any hints? >>=20 >> Thank you, --=20 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 --Apple-Mail=_E748DAAE-F6F7-4641-A14D-0C2BCF7DE037 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 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.

=3D=3D=3D LMTX version =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
%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}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D

=3D=3D=3D MkIV version =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D
%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}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D

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 =C3=A0 13:40, Otared Kavian = <otared@gmail.com> a =C3=A9crit :

Hi = Jean-Philippe,

The following is better than = the one I sent earlier:

\definemathmatrix[mymatrix]
= [left=3D{\left(\,},
right=3D{\ \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) :

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

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

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

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

Any hints?

Thank you,

-- 
Jean-Philippe Rey
91192 Gif-sur-Yvette Cedex - = France
Empreinte PGP : 807A = 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51

= --Apple-Mail=_E748DAAE-F6F7-4641-A14D-0C2BCF7DE037-- --===============4396092110471491683== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============4396092110471491683==--