How can I label the columns and rows of a matrix?

You may use table to recreate the matrix structure.

$ 
#table(
    columns: (auto,)+(3pt,)+(auto,)*5+(3pt,),
    stroke: none,
    align: (right + horizon,) + (center + horizon,)*7,
    [],[], $I$, $J$, $K$, $L$, $M$, [],
    $I$, table.cell(rowspan: 5, box(stroke: none, inset: (top: -0.5em), $lr("[", size: #875%)$)), $0$, $1$, $0$, $1$, $0$, table.cell(rowspan: 5, box(stroke: none, inset: (top: -0.5em), $lr("]", size: #875%)$)),
    $J$, $0$, $0$, $1$, $0$, $1$,
    [winner  $K$], $1$, $0$, $0$, $1$, $1$,
    $L$, $0$, $1$, $0$, $0$, $0$,
    $M$, $0$, $0$, $0$, $1$, $0$,
  )
 $

I don’t know a method that can automatically adjust the size of delimiters.

1 Like