From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/25249 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: math align Date: Mon, 16 Jan 2006 13:30:42 +0100 Message-ID: <43CB91F2.3020009@wxs.nl> References: <43CACEB2.7030708@wxs.nl> <43CB6121.6080100@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090006020903020505070501" X-Trace: sea.gmane.org 1137414668 1977 80.91.229.2 (16 Jan 2006 12:31:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jan 2006 12:31:08 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Jan 16 13:31:01 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 1EyTVc-0007it-6Y for gctc-ntg-context-518@m.gmane.org; Mon, 16 Jan 2006 13:30:53 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id EBF16127CC; Mon, 16 Jan 2006 13:30:49 +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 23397-05; Mon, 16 Jan 2006 13:30:47 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 27B10127D4; Mon, 16 Jan 2006 13:30:47 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 1AD88127D4 for ; Mon, 16 Jan 2006 13:30:45 +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 23396-05 for ; Mon, 16 Jan 2006 13:30:43 +0100 (CET) Original-Received: from mail.pragma-ade.net (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by ronja.ntg.nl (Postfix) with SMTP id 9CA5A127CC for ; Mon, 16 Jan 2006 13:30:43 +0100 (CET) Original-Received: from [10.100.1.102] (unverified [10.100.1.102]) by controller-1 (SurgeMail 3.5b3) with ESMTP id 841 for ; Mon, 16 Jan 2006 07:41:36 +0300 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <43CB6121.6080100@elvenkind.com> X-Server: High Performance Mail Server - http://surgemail.com r=-274017400 X-Authenticated-User: hagen@controller-1 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 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:25249 Archived-At: This is a multi-part message in MIME format. --------------090006020903020505070501 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Taco Hoekwater wrote: > > > David Arnold wrote: > >> And where should we put this module temporarily? > > > Put it in the local directory and do > > \input math-ext > > at the top of your test files. > attached is a next version with 'definable' aligns \definemathalign[myalign][...] \startmyalign ... Hans --------------090006020903020505070501 Content-Type: text/x-tex; name="math-ext.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="math-ext.tex" %D \module %D [ file=math-ext, %D version=2006.01.14, %D title=\CONTEXT\ Math Macros, %D subtitle=Extra Macros, %D author={Hans Hagen \& Taco Hoekwater}, %D date=\currentdate, %D copyright=\PRAGMA] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. %M \ifx\startalign\undefined \input math-ext.tex \fi % some simple math constructs (based on user requests) % % preliminary \unprotect % adapted stuff % we need to make this plain code a bit more 'readable' \def\openup {\afterassignment\dopenup\scratchdimen=} \def\dopenup {\advance\lineskip \scratchdimen \advance\baselineskip \scratchdimen \advance\lineskiplimit\scratchdimen} \def\jot{.25\bodyfontsize} % plain tex: 3 pt (todo: better name) \newif\ifdt@p \def\displ@y % \presetdisplayspacing or so {\global\dt@ptrue \openup\jot \mathsurround\zeropoint \everycr{\noalign{% \ifdt@p \global\dt@pfalse \ifdim\prevdepth>-\thousandpoint \vskip-\lineskiplimit \vskip\normallineskiplimit \fi \else \penalty\interdisplaylinepenalty \fi}}} % context (hooks) \let\normaldispl@y\displ@y \def\displ@y{\resetdisplaymatheq\normaldispl@y} \let\presetdisplaymath\displ@y % plain tex value: \centering = 0pt plus 1000pt minus 1000pt % plain tex valye: \jot = 3pt % n>1 #### needed, strange # interaction (maybe we need a toks in recurse ane no macro) \def\buildeqalign {\scratchtoks\emptytoks \dorecurse{\mathalignparameter\c!m} {\ifnum\recurselevel>\plusone \appendtoks \tabskip\mathalignparameter\c!distance&\tabskip\zeropoint \to\scratchtoks \fi \expanded{\scratchtoks{\the\scratchtoks\the\!!toksa}}% \dorecurse{\numexpr\mathalignparameter\c!n-\plusone\relax} {\expanded{\scratchtoks{\the\scratchtoks\the\!!toksb}}}}% \expanded{\scratchtoks{\the\scratchtoks\the\!!toksc}}} \def\forgetalign {\tabskip\zeropoint\everycr\emptytoks} \def\eqalign#1% why no halign here, probably because of displaywidth {\!!toksa{\strut\hfil$\displaystyle{##}$}% \!!toksb{&$\displaystyle{{}##}$\hfil}% \!!toksc\emptytoks \buildeqalign \null\,\vcenter {\openup\jot \mathsurround\zeropoint \expandafter \ialign \expandafter {\the\scratchtoks\crcr#1\crcr}% }\,} \def\prepareeqalignno {\!!toksa{\hfil$\forgetalign\displaystyle{##}$\tabskip\zeropoint}% \!!toksb{&$\forgetalign\displaystyle{{}##}$\tabskip\zeropoint}% \!!toksc{\hfil\tabskip\centering &\llap{$\forgetalign##$}\tabskip\zeropoint}% \buildeqalign \presetdisplaymath \tabskip\centering} \def\prepareleqalignno {\!!toksa{\hfil$\forgetalign\displaystyle{##}$\tabskip\zeropoint}% \!!toksb{&$\forgetalign\displaystyle{{}##}$\tabskip\zeropoint}% \!!toksc{\hfil\tabskip\centering &\kern-\displaywidth\rlap{$\forgetalign##$}\tabskip\displaywidth}% \buildeqalign \presetdisplaymath \tabskip\centering} \def\eqalignno#1% {\prepareeqalignno \halign to \displaywidth \expandafter {\the\scratchtoks\crcr#1\crcr}} \def\leqalignno#1% {\prepareleqaligno \halign to \displaywidth \expandafter {\the\scratchtoks\crcr#1\crcr}} \def\aligneqalignno {\prepareeqalignno \halign to \displaywidth \expandafter \bgroup\the\scratchtoks\crcr} \def\alignleqalignno {\prepareleqalignno \halign to \displaywidth \expandafter \bgroup\the\scratchtoks\crcr} \def\finishalignno {\crcr\egroup} \definesystemvariable{eq} \def\setupmathalign {\dodoubleempty\dosetupmathalign} \def\dosetupmathalign[#1][#2]% {\ifsecondargument \getparameters[\??eq#1][#2]% \else \getparameters[\??eq][#1]% \fi} \let\currentmathalign\empty \def\mathalignparameter#1% {\executeifdefined{\??eq\currentmathalign#1}{\executeifdefined{\??eq#1}\empty}} \setupmathalign [\c!n=2, \c!m=1, \c!distance=1em] \def\numberedeqalign {\doifelse\@@fmlocation\v!left\alignleqalignno\aligneqalignno} \def\doxxdoubleempty#1#2% {\ifx#2[\expandafter\dodoxxdoubleempty\else\expandafter\noxxdoubleempty\fi#1#2} \def\dodoxxdoubleempty#1[#2]#3% {\ifx#3[\else\expandafter\nonoxxdoubleempty\fi#1[#2]#3} \def\noxxdoubleempty #1{#1[][]} \def\nonoxxdoubleempty#1[#2]{#1[#2][]} \def\doalignNR[#1][#2]% {\doifsomething{#1} {\doifelse{#1}{+} {\doformulanumber[][#2][]{}} {\doformulanumber[#1][#2][]{}}}\cr} \def\dostartmathalign[#1][#2]% {\edef\currentmathalign{#1}% \doifassignmentelse{#2}{\setupmathalign[#1][#2]}\donothing \def\NC{\def\NC####1{&####1}}% \def\EQ{&=}% \def\NR{&\doxxdoubleempty\doalignNR}% % amstex compatibility mode: (ugly) \def\notag{\def\\{&\crcr}}% \doifelse{#2}{*}{\def\\{&\crcr}}{\def\\{&\doalignNR[+][]\crcr}}% % end of compatibility mode \numberedeqalign} \let\dostopmathalign\finishalignno \def\definemathalign {\dodoubleempty\dodefinemathalign} \def\dodefinemathalign[#1]% [#2]% {\setvalue{\e!start#1}{\dodoubleempty\dostartmathalign[#1]}% \setvalue{\e!stop #1}{\dostopmathalign}% \setupmathalign[#1]}% [#2] \definemathalign[align] % default case % \def\startsplit % {\startalign[*]} % no number by default % % \def\stopsplit % {&\doalignNR[+][]\crcr % for a number on last line % \stopalign} %D \startbuffer %D \placeformula \startformula \eqalignno { %D a &= b & \formulanumber \cr %D c &= d \cr %D &= e \cr %D &= f & \formulanumber %D } \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign %D \NC a \EQ b \NR[+] %D \NC c \EQ d \NR %D \NC \EQ f \NR[for:demo-a-1] %D \NC \EQ g \NR[for:demo-a-2][a] %D \NC \EQ h \NR[for:demo-a-3][b] %D \NC \EQ i \NR %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign %D \NC a \EQ b \NR[+] %D \NC c \EQ d \NR %D \NC \EQ f \NR %D \NC \EQ g \NR %D \NC \EQ h \NR %D \NC \EQ i \NR[+] %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign %D a &= b \\ %D c &= d \notag \\ %D &= e \notag \\ %D &= f \\ %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign %D a &= b \NR[+] %D c &= d \NR %D &= e \NR %D &= f \NR[+] %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign %D \NC a \NC \eq b \NR[+] %D \NC c \NC \neq d \NR %D \NC \NC \neq f \NR[for:demo-b-1] %D \NC \NC \geq g \NR[for:demo-b-2][a] %D \NC \NC \leq h \NR[for:demo-b-3][b] %D \NC \NC \neq i \NR %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign[*] %D a &= b \\ %D c &= d \\ %D &= e \\ %D &= f \\ %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign %D x &= y \\ %D a &= b \\ %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign[m=3] %D x &= y & x &= y & z &= t \\ %D a &= b & p &= q & w &= s \\ %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign[m=3,distance=0pt] %D x &= y &= x &= y &= z &= t \\ %D a &= b &= p &= q &= w &= s \\ %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer %D %D \startbuffer %D \placeformula \startformula \startalign[n=5,distance=0pt] %D x &= yy &= xx &= yy &= zz \\ %D a &= b &= p &= q &= w \\ %D \stopalign \stopformula %D \stopbuffer %D %D \typebuffer \getbuffer \protect \endinput --------------090006020903020505070501 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 --------------090006020903020505070501--