# [NTG-context] mathmatrix and internal lines

Otared Kavian otared at gmail.com
Thu Nov 26 10:58:57 CET 2020

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 at 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 at 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 at 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
> ___________________________________________________________________________________