On Mon, 17 Jul 2006, Hans Hagen wrote:

> Bruce H. Wagner wrote:
>> 
>> 
>> Incidentally, the reason I am using the LaTeX syntax is that we are 
>> translating LaTeX code into Context automatically using a perl script, and 
>> it's therefore much easier to stick to whatever LaTeX code works. 
>> Basically, I just want something comparable to the array environment in 
>> LaTeX, which works very nicely.
>> 
> Aditya is in more or less charge of the specification/tryout part of the math 
> extensions and taco/myself implement things based on that input, so i suggest 
> that the two of you come up with specs

Context supports everything that latex array provides, with a slightly 
different syntax. Some extract from the update on myway on alignment 
(I am still working on it)

% \def\ShowExample
%  {\hairline
%    \typebuffer
%    \hairline
%    \getbuffer}


\CONTEXT\ provides \tex{startmatrix} for generic alignment mechanism.
\startbuffer
\startformula
   \startmatrix
     \NC A \NC B \NC C \NR
     \NC a \NC b \NC c \NR
     \NC 1 \NC 2 \NC 3 \NR
   \stopmatrix
\stopformula
\stopbuffer
\ShowExample

It can take a \type<<left=>> and \type<<right=>> option which can be 
used to
typeset matrices
\startbuffer
\startformula
   I = \startmatrix[left={\left(\,},right={\,\right)}]
     \NC 1 \NC 0 \NC 0 \NR
     \NC 0 \NC 1 \NC 0 \NR
     \NC 0 \NC 0 \NC 1 \NR
   \stopmatrix
\stopformula
\stopbuffer
\ShowExample

It is possible to \tex{definemathmatrix} to use the construct 
repeatedly.
\startbuffer
% Paranthesis
\definemathmatrix
   [pmatrix]
   [left={\left(\,},right={\,\right)}]

% Brackets
\definemathmatrix
   [bmatrix]
   [left={\left[\,},right={\,\right]}]

% Curly braces
\definemathmatrix
   [Bmatrix]
   [left={\left\{\,},right={\,\right\}}]

% vertical bars
\definemathmatrix
   [vmatrix]
   [left={\left\vert\,},right={\,\right\vert}]

% double vertical bars
\definemathmatrix
   [Vmatrix]
   [left={\left\Vert\,},right={\,\right\Vert}]

\startformula
   I = \startpmatrix
     \NC 1 \NC 0 \NC 0 \NR
     \NC 0 \NC 1 \NC 0 \NR
     \NC 0 \NC 0 \NC 1 \NR
   \stoppmatrix
   = \startbmatrix
     \NC 1 \NC 0 \NC 0 \NR
     \NC 0 \NC 1 \NC 0 \NR
     \NC 0 \NC 0 \NC 1 \NR
   \stopbmatrix
   = \startBmatrix
     \NC 1 \NC 0 \NC 0 \NR
     \NC 0 \NC 1 \NC 0 \NR
     \NC 0 \NC 0 \NC 1 \NR
   \stopBmatrix
\stopformula
\startformula
   \startvmatrix
     \NC a \NC b \NR
     \NC c \NC d \NR
   \stopvmatrix
   \quad
   \startVmatrix
     \NC a \NC b \NR
     \NC c \NC d \NR
   \stopVmatrix
\stopformula
\stopbuffer
\ShowExample

It is possible to change the alignment of columns using \type{align=} 
option.
\startbuffer
\startformula
   \text{Let } A = \startpmatrix[align={left,right}]
     \NC 1 \NC 2  \NR
     \NC 3 \NC -5 \NR
   \stoppmatrix
\stopformula
\stopbuffer
\ShowExample

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to