From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/35644 Path: news.gmane.org!not-for-mail From: WN Newsgroups: gmane.comp.tex.context Subject: Re: extra math symbols and alignment Date: Wed, 01 Aug 2007 13:43:35 +0200 Message-ID: <46B071E7.9060002@tiscali.nl> References: <46AF38FC.309@tiscali.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030106080805090206020604" X-Trace: sea.gmane.org 1185968469 20854 80.91.229.12 (1 Aug 2007 11:41:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Aug 2007 11:41:09 +0000 (UTC) Cc: mailing list for ConTeXt users To: Aditya Mahajan Original-X-From: ntg-context-bounces@ntg.nl Wed Aug 01 13:41:02 2007 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 lo.gmane.org with esmtp (Exim 4.50) id 1IGCZa-0007yX-7O for gctc-ntg-context-518@m.gmane.org; Wed, 01 Aug 2007 13:41:02 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 917251FFE5; Wed, 1 Aug 2007 13:41:01 +0200 (CEST) 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 30843-03-3; Wed, 1 Aug 2007 13:40:52 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A36DF1FFDB; Wed, 1 Aug 2007 13:40:52 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 598391FFDB for ; Wed, 1 Aug 2007 13:40:50 +0200 (CEST) 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 30843-03-2 for ; Wed, 1 Aug 2007 13:40:47 +0200 (CEST) Original-Received: from smtp-out0.tiscali.nl (smtp-out0.tiscali.nl [195.241.79.175]) by ronja.ntg.nl (Postfix) with ESMTP id 75CFB1FFD9 for ; Wed, 1 Aug 2007 13:40:47 +0200 (CEST) Original-Received: from [82.171.74.44] (helo=[192.168.1.36]) by smtp-out0.tiscali.nl with esmtp (Tiscali http://www.tiscali.nl) id 1IGCZL-00032t-2h; Wed, 01 Aug 2007 13:40:47 +0200 User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) In-Reply-To: X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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:35644 Archived-At: This is a multi-part message in MIME format. --------------030106080805090206020604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Aditya I tried your code and performed more tests. My first tests show your fix works. But than I added a \section{} in my test code and I am sorry to say that the math matrix alignment does not work at that point. However the extra math fonts I defined still do work. General observation I thought from the examples like using the RSFS font on the wiki page http://wiki.contextgarden.net/rsfs that using other fonts for math should be easy. Thinking about this specific example I now understand that this example is flawed as some default math characters are also overwritten. Thanks for your help Wim PS Attached my modified test code along with the map file for the RSFS fonts. For the RSFS fonts I am using \definedfont and not using the definebodyfont. > Hi Wim, > > On Tue, 31 Jul 2007, WN wrote: > > see previous email > Phew! This was a hard to find bug. First, to illustrate the bug: > \definetypeface[mainface] [rm] [serif] [modern] [default] [encoding=texansi] > \definetypeface[mainface] [mm] [math] [modern] [modern] [encoding=texansi] > > \setupbodyfont[mainface,11pt] > > \loggingall > > \starttext > \startformula > A = \startmatrix[align={left,right}] > \NC 11 \NC 2 \NR > \NC 2 \NC -5 \NR > \stopmatrix > \stopformula > > \stoptext > > Try with and without the font declarations. With the font > declarations, you lost matrix alignment. The reason is that > \startmatrix uses \scratchcounter, which gets rewritten when using a > font collection other than "default". One fix it to replace > \scractcounter in matrix constructions by some other counter, for > example \!!counta. > > So, add this to your file (beware of false line breaks in email) > > \unprotect > > \def\dostartmathmatrix[#1][#2]% > {\begingroup > \edef\currentmathmatrix{#1}% > \doifassignmentelse{#2}{\setupmathmatrix[#1][#2]}\donothing > \null > \executeifdefined{\??mx:\mathmatrixparameter\c!location}{\getvalue{\??mx:\v!lohi}}% > \mathmatrixleft > \mathmatrixbox\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\zerocount % could be \!!counta > \processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}% > \!!counta=\ifnum\eqaligncolumn>\!!counta \eqaligncolumn \else \plusone \fi > \global\eqaligncolumn\plusone > \preparemathmatrix } % uses !!counta > > \def\buildmathmatrix % beware: etex only > {\scratchtoks\emptytoks > \expanded{\scratchtoks{\the\scratchtoks\the\!!toksa}}% > \dorecurse{\numexpr\!!counta-\plusone\relax} > {\expanded{\scratchtoks{\the\scratchtoks\the\!!toksb}}}% > \expanded{\scratchtoks{\the\scratchtoks\the\!!toksc }}} > > \protect > > Hans, this needs to be changed in core-mat.tex. I do not know if > something can be done to avoid such errors in future. > > Wim, I am attaching a modified version of your file which gives the > correct output. (I needed to make some changes since I did not have > your map file for rsfs). You loose some symbols from the math > collection. I do not know how to add extra math symbol sets without > loosing these characters. Look at math-tim.tex to see how more > families can be supported. But I would suggest waiting for mkiv, where > the limit on font families will be removed and some of this font mess > would be cleaner. > > Aditya --------------030106080805090206020604 Content-Type: text/x-tex; name="testalignfont.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="testalignfont.tex" \tracetypescriptstrue \unprotect \def\dostartmathmatrix[#1][#2]% {\begingroup \edef\currentmathmatrix{#1}% \doifassignmentelse{#2}{\setupmathmatrix[#1][#2]}\donothing \null \executeifdefined{\??mx:\mathmatrixparameter\c!location}{\getvalue{\??mx:\v!lohi}}% \mathmatrixleft \mathmatrixbox\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\zerocount % could be \!!counta \processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}% \!!counta=\ifnum\eqaligncolumn>\!!counta \eqaligncolumn \else \plusone \fi \global\eqaligncolumn\plusone \preparemathmatrix } % uses !!counta \def\buildmathmatrix % beware: etex only {\scratchtoks\emptytoks \expanded{\scratchtoks{\the\scratchtoks\the\!!toksa}}% \dorecurse{\numexpr\!!counta-\plusone\relax} {\expanded{\scratchtoks{\the\scratchtoks\the\!!toksb}}}% \expanded{\scratchtoks{\the\scratchtoks\the\!!toksc }}} \protect \startmathcollection [extra] \definemathsymbol [oiint] [op] [mc] ["08] [mc] ["09] \definemathsymbol [oiiint] [op] [mc] ["29] [mc] ["2a] \definemathsymbol [ointctrclockwise] [op] [mc] ["0A] [mc] ["0B] \definemathsymbol [ointclockwise] [op] [mc] ["0C] [mc] ["0D] \definemathsymbol [varointctrclockwise] [op] [mc] ["2B] [mc] ["2C] \definemathsymbol [varointclockwise] [op] [mc] ["2D] [mc] ["2E] \definemathsymbol [iint] [op] [mc] ["21] [mc] ["22] \definemathsymbol [iiint] [op] [mc] ["23] [mc] ["24] \definemathsymbol [iiiint] [op] [mc] ["25] [mc] ["26] \definemathsymbol [idotsint] [op] [mc] ["27] [mc] ["28] \definemathsymbol [oiintctrclockwise] [op] [mc] ["40] [mc] ["41] \definemathsymbol [oiintclockwise] [op] [mc] ["48] [mc] ["49] \definemathsymbol [varoiintctrclockwise][op] [mc] ["4A] [mc] ["4B] \definemathsymbol [varoiintclockwise] [op] [mc] ["42] [mc] ["43] \definemathsymbol [oiiintctrclockwise] [op] [mc] ["44] [mc] ["45] \definemathsymbol [oiiintclockwise] [op] [mc] ["4C] [mc] ["4D] \definemathsymbol [varoiiintctrclockwise][op] [mc] ["4E] [mc] ["4F] \definemathsymbol [varoiiintclockwise] [op] [mc] ["46] [mc] ["47] \stopmathcollection \loadmapfile[original-youngryu-tx.map] \loadmapfile[texnansi-wim-rsfs.map] \starttypescript [math] [modern,computer-modern,latin-modern,ams] [size] \definebodyfont [28pt,24pt,18pt,17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [mc=txexa sa 1] \stoptypescript \definetypeface[mainface] [rm] [serif] [times] [default] [encoding=texnansi] \definetypeface[mainface] [mm] [math] [modern] [modern] [encoding=texnansi] \setupbodyfont[mainface,11pt] \def\scr#1{\text{\definedfont[texnansi-rsfs10]#1\/}} \enablemathcollection[extra] \definemathmatrix[mycases][left={\left\{\,},right={\,\right.}] \definemathmatrix[aligned][n=3,align={right,left,left},distance=4pt] \definemathmatrix[alignedfour][n=4,align={left,middle,left,right}] \startbuffer \startformula \startalignedfour[left={\left\{},right={\right\}}] \NC left \NC middle \NC left \NC right \NR \NC aaa \NC = \NC 0 \NC |x| > 0 \NR \NC aaaa \NC = \NC 1 \NC |x| < 0 \NR \NC bbb \NC = \NC 2 \NC bb \NR \NC bb \NC = \NC 3 \NC ccc \NR \stopalignedfour \stopformula \startformula \startmycases[n=4,align={left,middle,middle,right},distance=1em] \NC left \NC middle \NC middle \NC right \NR \NC aaaaaa \NC baaaaaaaaa \NC cccc \NC ddddddddddddd \NR \NC aaaaaaaaa \NC bbb \NC c \NC ddd \NR \stopmycases \stopformula \startformula \startaligned[left={\left.},right={\right\}}] \NC (\lambda + \mu ) \cdot a \NC = \NC \lambda \cdot a + \mu \cdot a \NR \NC \lambda ( a + b ) \NC = \NC \lambda \cdot a + \lambda \cdot b \NR \stopaligned \quad \text{(distributieve eigenschappen)} \stopformula \stopbuffer \starttext Test user defined math matrices without a section (with Aditya's fix) \blank Math matrix alignment works. \getbuffer \section{Test user defined math matrices but after a section (with Aditya's fix)} Math matrix alignment broken \getbuffer \section{Extra math symbols} \startformula \oiint \oiiint \ointctrclockwise \ointclockwise \varointctrclockwise \varointclockwise \iint \iiint \iiiint \idotsint \oiintctrclockwise \oiintclockwise \varoiintctrclockwise \varoiintclockwise \oiiintctrclockwise \oiiintclockwise \varoiiintctrclockwise \varoiiintclockwise \stopformula \startformula \alpha \beta \gamma \delta \mu \nu \eta \xi \sigma \epsilon \Gamma \Delta \stopformula \startformula {\scr{A} \scr{B} \scr{C} \scr{D} \scr{E} \scr{F} \scr{G} \scr{H} \scr{L}} \stopformula \type{\cal ABCDEFGHIJKLMNOPQRSTUVWXYZ} \startformula {\cal ABCDEFGHIJKLMNOPQRSTUVWXYZ} \stopformula \page \section{Default math characters} \showmathcharacters \stoptext --------------030106080805090206020604 Content-Type: text/plain; name="texnansi-wim-rsfs.map" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="texnansi-wim-rsfs.map" % This file is generated by the TeXFont Perl script. % % You need to add the following line to your file: % % \pdfmapfile{+texnansi-wim-rsfs.map} % % In ConTeXt you can best use: % % \loadmapfile[texnansi-wim-rsfs.map] texnansi-raw-rsfs10 rsfs10 4 < rsfs10.pfb texnansi.enc texnansi-raw-rsfs5 rsfs5 4 < rsfs5.pfb texnansi.enc texnansi-raw-rsfs7 rsfs7 4 < rsfs7.pfb texnansi.enc --------------030106080805090206020604 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --------------030106080805090206020604--