ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	bruce-wagner@redwoods.edu, david-arnold@redwoods.edu
Subject: Re: align question
Date: Tue, 18 Jul 2006 11:12:24 -0400 (EDT)	[thread overview]
Message-ID: <Pine.WNT.4.63.0607181108380.4016@nqvgln> (raw)
In-Reply-To: <44BB5CE6.9020309@wxs.nl>

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

  reply	other threads:[~2006-07-18 15:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-15  5:07 David Arnold
2006-07-15  5:21 ` Aditya Mahajan
2006-07-15  5:56   ` Bruce H. Wagner
2006-07-16  5:36     ` Aditya Mahajan
2006-07-17  9:48     ` Hans Hagen
2006-07-18 15:12       ` Aditya Mahajan [this message]
2006-07-18 18:40         ` Bruce H. Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.WNT.4.63.0607181108380.4016@nqvgln \
    --to=adityam@umich.edu \
    --cc=bruce-wagner@redwoods.edu \
    --cc=david-arnold@redwoods.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).