[NTG-context] Aaligned numbers in a matrix?

Aditya Mahajan adityam at umich.edu
Mon Feb 27 05:40:05 CET 2023


On Mon, 27 Feb 2023, Bruce Horrocks via ntg-context wrote:

> I'm using the following MWE to produce a matrix:
> 
> \definemathmatrix[bmatrix]
>   [matrix:brackets]
>   [simplecommand=bmatrix]
> \starttext
> $ a \rightarrow
>   \bmatrix{1, 2, 3, 4; 
>            2, 1, 4, 3;
>            3,-4, 1,-2;
>            4,-3, 2,-1} $
> \stoptext
> 
> The columns with negative numbers in are centred and I would rather have them right-aligned so that the digits stack up above each other and the negative signs stick out to the left, so to speak. Is there an easy way to achieve this?

You can right align all columns, though I am not sure that this looks better, because column 2 and 3 now appear to be "too close".

\definemathmatrix[bmatrix]
  [matrix:brackets]
  [align=all:right,simplecommand=bmatrix]
\starttext
$ a \rightarrow
  \bmatrix{1, 2, 3, 4;
           2, 1, 4, 3;
           3,-4, 1,-2;
           4,-3, 2,-1} $
\stoptext

Aditya


More information about the ntg-context mailing list