Hi,

On Thu, Feb 27, 2025 at 3:18 AM Matthias Weber
<[email protected]> wrote:
>
> Hi,
>
> I’d like to typeset a matrix with vertical and horizontal lines like so:
>
> starttext
>
> \startformula
> \startmatrix
>    \HL
>    \VL 16 \VL 3  \VL  2 \VL  12 \VL\NR
>    \HL
>    \VL 5 \VL 10 \VL 11 \VL 8  \VL\NR
>    \HL
>    \VL 9 \VL 6 \VL 7 \VL 12 \VL\NR
>    \HL
>    \VL 4 \VL 15 \VL 14 \VL 1 \VL\NR
>    \HL
> \stopmatrix
> \stopformula
>
>
> \starttable[|c|c|c|c|]
> \HL
>  \VL $16$ \VL $3$ \VL $2$ \VL $12$ \VL \FR
> \HL
> \VL $5$ \VL $10$ \VL $11$ \VL $8$\VL \SR
> \HL
> \VL $9$ \VL $6$ \VL $7$\VL $12$ \VL\SR
> \HL
> \VL $4$ \VL $15$ \VL $14$ \VL  $1$ \VL\SR
> \HL
> \stoptable
>
> \stoptext
>
> In the matrix version, the horizontal lines extend too far to the left.
>
> Ideally, I would like the cells to be squares, with the entries centered.
>
> Thanks for any suggestions!
>
> Matthias

You can try \VC instead of \VL for the first column. Also, square
cells might be easiest(?) to get with natural tables.

\starttext

\startformula
  x +
\startmatrix
   \HL
   \VC 16 \VL  3 \VL  2 \VL 12 \VL\NR
   \HL
   \VC  5 \VL 10 \VL 11 \VL  8 \VL\NR
   \HL
   \VC  9 \VL  6 \VL  7 \VL 12 \VL\NR
   \HL
   \VC  4 \VL 15 \VL 14 \VL  1 \VL\NR
   \HL
\stopmatrix
  + y
\stopformula

\setupTABLE[c][width=1cm,offset=overlay,align={middle,lohi}]
\setupTABLE[r][height=1cm]
\bTABLE
   \bTR \bTD 16 \eTD  \bTD  3 \eTD \bTD  2 \eTD \bTD 12 \eTD \eTR
   \bTR \bTD  5 \eTD  \bTD 10 \eTD \bTD 11 \eTD \bTD  8 \eTD \eTR
   \bTR \bTD  9 \eTD  \bTD  6 \eTD \bTD  7 \eTD \bTD 12 \eTD \eTR
   \bTR \bTD  4 \eTD  \bTD 15 \eTD \bTD 14 \eTD \bTD  1 \eTD \eTR
\eTABLE

\stoptext

/Mikael
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to