ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Aaligned numbers in a matrix?
@ 2023-02-27  0:55 Bruce Horrocks via ntg-context
  2023-02-27  1:09 ` fv leung via ntg-context
  2023-02-27  4:40 ` Aditya Mahajan via ntg-context
  0 siblings, 2 replies; 3+ messages in thread
From: Bruce Horrocks via ntg-context @ 2023-02-27  0:55 UTC (permalink / raw)
  To: ntg-context mailing list; +Cc: Bruce Horrocks

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?

—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Aaligned numbers in a matrix?
  2023-02-27  0:55 Aaligned numbers in a matrix? Bruce Horrocks via ntg-context
@ 2023-02-27  1:09 ` fv leung via ntg-context
  2023-02-27  4:40 ` Aditya Mahajan via ntg-context
  1 sibling, 0 replies; 3+ messages in thread
From: fv leung via ntg-context @ 2023-02-27  1:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: fv leung


[-- Attachment #1.1: Type: text/plain, Size: 1496 bytes --]

See if this way suits you.
\definemathmatrix[bmatrix]
  [matrix:brackets]
  [simplecommand=bmatrix]
\starttext
$ a \rightarrow
  \bmatrix{1, \hfill 2, 3, \hfill 4;
           2, \hfill 1, 4, \hfill 3;
           3,-4, 1,-2;
           4,-3, 2,-1} $
\stoptext

Bruce Horrocks via ntg-context <ntg-context@ntg.nl> 於 2023年2月27日 週一
上午8:56寫道:

> 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?
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : https://contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 2354 bytes --]

[-- Attachment #2: Type: text/plain, Size: 496 bytes --]

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Aaligned numbers in a matrix?
  2023-02-27  0:55 Aaligned numbers in a matrix? Bruce Horrocks via ntg-context
  2023-02-27  1:09 ` fv leung via ntg-context
@ 2023-02-27  4:40 ` Aditya Mahajan via ntg-context
  1 sibling, 0 replies; 3+ messages in thread
From: Aditya Mahajan via ntg-context @ 2023-02-27  4:40 UTC (permalink / raw)
  To: Bruce Horrocks via ntg-context; +Cc: Aditya Mahajan

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-27  4:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27  0:55 Aaligned numbers in a matrix? Bruce Horrocks via ntg-context
2023-02-27  1:09 ` fv leung via ntg-context
2023-02-27  4:40 ` Aditya Mahajan via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).