From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/26448 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: Feature Request: mathmatrix enhancement Date: Tue, 21 Mar 2006 16:44:12 +0100 Message-ID: <44201F4C.5070906@elvenkind.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040709030701040009040300" X-Trace: sea.gmane.org 1142956111 7086 80.91.229.2 (21 Mar 2006 15:48:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 21 Mar 2006 15:48:31 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Tue Mar 21 16:48:27 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1FLj5l-0006s0-51 for gctc-ntg-context-518@m.gmane.org; Tue, 21 Mar 2006 16:48:17 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 995F31277E; Tue, 21 Mar 2006 16:48:16 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 12405-04; Tue, 21 Mar 2006 16:48:15 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D863F12778; Tue, 21 Mar 2006 16:44:16 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 626A212778 for ; Tue, 21 Mar 2006 16:44:15 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 12405-02 for ; Tue, 21 Mar 2006 16:44:14 +0100 (CET) Original-Received: from glenfiddich.elvenkind.com (elvenknd.xs4all.nl [213.84.171.68]) by ronja.ntg.nl (Postfix) with SMTP id 0E1651276F for ; Tue, 21 Mar 2006 16:44:13 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by glenfiddich.elvenkind.com (Postfix) with ESMTP id 8DFAA1B44F for ; Tue, 21 Mar 2006 16:44:13 +0100 (CET) Original-Received: from glenfiddich.elvenkind.com ([127.0.0.1]) by localhost (glenfiddich.elvenkind.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13161-05 for ; Tue, 21 Mar 2006 16:44:13 +0100 (CET) Original-Received: from [10.10.0.6] (glenlivet.elvenkind.com [10.10.0.6]) by glenfiddich.elvenkind.com (Postfix) with ESMTP id 2F03A15FCF for ; Tue, 21 Mar 2006 16:44:13 +0100 (CET) User-Agent: Mozilla Thunderbird 1.0.6-7.1.20060mdk (X11/20050322) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: X-Virus-Scanned: by amavisd-new at elvenkind.net X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:26448 Archived-At: This is a multi-part message in MIME format. --------------040709030701040009040300 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, See attachment. The final value of the "align=" list is repeated for any leftover columns, and align=middle is default, of course. Cheers, taco PS The alignment preamble uses \hskip instead of \tabskip, because that was the only solution I could find that does all intercolumn spacing correct while still allowing endlessly repeating columns. Aditya Mahajan wrote: > Hi, > > Is it possible to have allow math matrix column alignments to be > configurable, on the lines of align={left,left} of \startalign. > I want to be albe to say > > \startformula > \startmatrix[align={right,left}] > \NC x \NC = a + d \NR > \NC y \NC = d \NR > \stopmatrix > \stopformula > > to give me > x = a + d > y = d > > This is a contrived example. The actual equation that I want to type > is > > \startformula > \text{Let }{\cal R} = \bigcup_{P_{X_1},P_{X_2}} \left\{ > (R_1, R_2) : > \startmatrix[distance=0.1em] > \NC \hfill R_1 \NC < I(X_1 ; Y \mid X_2) \hfill \NR > \NC \hfill R_2 \NC < I(X_2 ; Y \mid X_1) \hfill \NR > \NC \hfill R_1 + R_2 \NC < I(X_1,X_2 ; Y) \hfill \NR > \stopmatrix\right\} > \stopformula > > All these manual hfills look ugly. > > Is matrix the wrong way to go about this? Should we rather have a > aligned environment like amsmath? Or is there a simple alternative > that I have overlooked? > > > Thanks > Aditya > --------------040709030701040009040300 Content-Type: application/x-tex; name="mat.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mat.tex" \unprotect \setupmathmatrix [\c!distance=1em, \c!left=, \c!right=, \c!align=middle] \def\dosetmatrixcolumn#1% {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\hfil \letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfil \doif{#1}\v!left {\letvalue{\??eq:\v!left :\number\eqaligncolumn}\relax \letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfil}% \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 \letvalue{\??eq:\v!right:\number\eqaligncolumn}\hfil}} \def\buildmathmatrix {\scratchtoks\emptytoks \expanded{\scratchtoks{\the\scratchtoks\the\!!toksa}}% \dorecurse{\numexpr\scratchcounter-\plusone\relax} {\expanded{\scratchtoks{\the\scratchtoks\the\!!toksb}}}% \expanded{\scratchtoks{\the\scratchtoks\the\!!toksc }}} \def\preparemathmatrix {\!!toksa{\strut \firstineqalign\leftofeqalign \span \textineqalign{##}\rightofeqalign }% \!!toksb{&\hskip\mathmatrixparameter\c!distance \nextineqalign\leftofeqalign \span \textineqalign{##}\rightofeqalign }% \!!toksc{&&\hskip\mathmatrixparameter\c!distance \leftofeqalign \span \textineqalign{##}\rightofeqalign }% \buildmathmatrix \halign \@EA \bgroup\the\scratchtoks \crcr} \def\dostartmathmatrix[#1][#2]% {\begingroup \edef\currentmathmatrix{#1}% \doifassignmentelse{#2}{\setupmathmatrix[#1][#2]}\donothing \null \mathmatrixparameter\c!left \vcenter\bgroup \pushmacro\domatrixNC \let\endmath\relax \def\NC{\domatrixNC}% \def\MC{\domatrixNC\ifmmode\else$\def\endmath{$}\fi}% \global\let\domatrixNC\dodomatrixNC \def\NR{\endmath\global\let\domatrixNC\dodomatrixNC\crcr}% \normalbaselines \mathsurround\zeropoint \everycr\emptytoks \tabskip\zeropoint \eqaligncolumn\zeropoint \processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}% \scratchcounter=\ifnum\eqaligncolumn>\scratchcounter \eqaligncolumn \else \plusone \fi \global\eqaligncolumn\plusone \preparemathmatrix } \protect \starttext \startformula \startmatrix \NC a + x \NC = \NC a + d \NR \NC y \NC = \NC d \NR \stopmatrix \stopformula to give me \startformula \startmatrix [distance=3pt,align={right,left}] \NC a + x \NC = a + d \NR \NC y \NC = d \NR \stopmatrix \stopformula and left and rightside: \startformula \startmatrix [left=\left(,right=\right)] \NC a + x \NR \NC y \NR \stopmatrix \stopformula This is a contrived example. The actual equation that I want to type is \startformula \text{Let }{\cal R} = \bigcup_{P_{X_1},P_{X_2}} \left\{ (R_1, R_2) : \startmatrix[distance=0.1em,align={left,right}] \NC \hfill R_1 \NC < I(X_1 ; Y \mid X_2) \hfill \NR \NC \hfill R_2 \NC < I(X_2 ; Y \mid X_1) \hfill \NR \NC \hfill R_1 + R_2 \NC < I(X_1 ; Y) \hfill \NR \stopmatrix\right\} \stopformula \startformula \text{Let }{\cal R} = \bigcup_{P_{X_1},P_{X_2}} \left\{ (R_1, R_2) : \startmatrix[distance=1em,align={left,right}] \NC R_1 \NC < I(X_1 ; Y \mid X_2) \NC R_1 \NR \NC \hfill Q_2 \NC < I(X_2 ; Y \mid X_1) \NC R_2 \NR \NC R_1 + R_2 \NC < I(X_1 ; Y) \NC R_1 + R_2 \NR \stopmatrix\right\} \stopformula \stoptext --------------040709030701040009040300 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --------------040709030701040009040300--