Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In LaTeX, I could use:

\left[\,\begin{array}{rr|r}2&-3&6\\ 3&4&-9\end{array}\,\right]

However, in ConTeXt, especially if I want right-alignments of columns, I seem to have to use:

    \NC 2 \NC -3 \NR
    \NC 3 \NC 4 \NR
    \NC 6 \NR
    \NC 9 \NR

which is extremely wordy and clumsy-looking (especially compared with the neat and succinct LaTeX).

So - what is the best way of typesetting augmented matrices in ConTeXt?


share|improve this question
There was a module written by Giuseppe Bilotta, called amsl, that had support for a \startarray ... \stoparray feature that is supposed to be like that of the AMS Latex module. If you google around you can find the implementation, but for some reason it is no longer on CTAN. –  Charles Stewart Apr 20 '11 at 13:05
The amsl module is available at contextgarden, but I would be really surprised if it works with MkIV (IIR, it also does some font changes, and that interface has changed). The array code should still work. –  Aditya Apr 20 '11 at 15:35

2 Answers 2

Here is a MWA of an idea mostly for Aditya to look at:

  {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfil
   % this is new:
   \doif{#1}\v!rule  {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\relax
                               {\kern -.5\mathalignmentparameter\c!distance
                                \kern -.5\mathalignmentparameter\c!distance}}%
   \doif{#1}\v!left  {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\relax
   \doif{#1}\v!right {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfil
                      \letvalue{\??eq:\v!right:\number\eqaligncolumn}\relax }%
   \doif{#1}\v!middle{\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfil



    \NC 2 \NC -3 \NC \NC 6 \NR
    \NC 3 \NC  4 \NC \NC 9 \NR


There are two things wrong with this bit of code:

  • the internal macro \dosetmatrixcolumn needs redefinition which should be done in context core itself, not as part of a document.
  • the \NC \NC is a little ugly.

still, it saves a lot of typing.

share|improve this answer
Isn't \processaction better than a bunch of \doifs? –  Aditya Jul 27 '11 at 5:56
I think that it is better to have a separate syntax for rules (and braces), something along the lines of TABLE macros. –  Aditya Jul 27 '11 at 5:58

Not a real answer, but the following codes give the same result

\left[\begin{array}{@{}rr|r@{}}2&-3&6\\ 3&4&-9\end{array}\right]

It's just a matter of teaching ConTeXt to do the \halign. Note that amsmath prefers tight spacing of the delimiters, as can be seen with the bmatrix environment, but that's a question of taste.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.