ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: WN <wneimeijer@tiscali.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: extra math symbols and alignment
Date: Tue, 31 Jul 2007 23:27:04 -0400 (EDT)	[thread overview]
Message-ID: <alpine.WNT.0.999.0707312246160.2696@nqvgln> (raw)
In-Reply-To: <46AF38FC.309@tiscali.nl>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3810 bytes --]

Hi Wim,

On Tue, 31 Jul 2007, WN wrote:

> Hi Aditya
>
> Basically I want to include the RSFS font and some user defined symbols from 
> txexa as explained in my previous email.
>
> I did some testing with the test code which I send and found the cause of the 
> problem, however no solution yet.
> The cause of the problem lies in the line where I say
>
> \definetypeface[MyFace] [mm] [math] [modern] *[modern] *[encoding=ec]
>
> This will enable the user defined symbols and all the math symbols as shown 
> via \showmathcharacters are correct.
>
> However all the matrix, mathmatrix environments don't adhere to the aligment 
> I specify except for the first option i.e.
> when I say \startmatrix[align={right, etc .... }] everything is aligned to 
> the right but the other aligment options are ignored.
>
> When I substitute *[modern]* with *[default]  *as in
>
> \definetypeface[MyFace] [mm] [math] [modern] *[default] *[encoding=ec]
>
> In this instance all the aligment as specified in the matrix, mathmatrix 
> environments work. However some of the
> math symbols like \Delta are incorrect. And my user defined symbols are also 
> incorrect.

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

[-- Attachment #2: Type: TEXT/PLAIN, Size: 4865 bytes --]

\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

\loadmapfile[original-youngryu-tx.map]

\starttypescript [math] [modern,computer-modern,latin-modern,ams] [size]
    \definebodyfont [17.3pt,14.4pt,12pt,11pt,10pt,9pt] [mm] [mb=rsfs10 sa 1]
    \definebodyfont [8pt,7pt] [mm] [mb=rsfs7 sa 1]
    \definebodyfont [6pt,5pt,4pt] [mm] [mb=rsfs5 sa 1]
    \definebodyfont [28pt,24pt,18pt,17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [mc=txexa sa 1]
\stoptypescript

\startmathcollection [default]
\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
\definefamilysynonym [default] [scriptfamily] [mb]
\def\scr{\fam\purefamily{scriptfamily}}

\definetypeface[MyFace] [rm] [serif] [modern] [default] [encoding=texansi]
\definetypeface[MyFace] [mm] [math] [modern] [modern]  [encoding=texansi]

\setupbodyfont[MyFace,11pt]


\definemathmatrix[mycases][left={\left\{\,},right={\,\right.}]

\starttext
\startformula
\Delta =
\startmatrix[n=4,align={left,middle,left,right}]
\NC -aaa \NC vvvvv \NC -wwwwwwww \NC wwwwwwww \NR
\NC aaaa \NC -vvvvv \NC wwwwwwww \NC www \NR
\NC -bbbbb \NC vv \NC -wwww \NC wwwwwwww \NR
\NC bbbbb \NC -vvvvv \NC wwwwwwww \NC wwwwwwww \NR
\stopmatrix
\stopformula

\startformula
\startmatrix[align={right, left}]
\NC aa \NC vvvv \NR
\NC vvvvv \NC -vvvvv  \NR
\NC -vvvvv \NC vvvvv  \NR
\NC vv \NC -vvvvv  \NR
\stopmatrix
\stopformula

\startformula
 \startalign[n=4,align={left,middle,middle,right}]
 \NC aaa\NC b\NC cccc\NC d\NR
 \NC a\NC bbb\NC c\NC ddd\NR
 \stopalign
 \stopformula

 \startformula
 \startmycases[n=4,align={left,middle,middle,right}]
 \NC aaa\NC b\NC cccc\NC d\NR
 \NC a\NC bbb\NC c\NC ddd\NR
 \stopmycases
\stopformula
\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
\type{\scr ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\startformula
{\scr ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\stopformula
\type{\cal ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\startformula
{\cal ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\stopformula

\page
\section{Default math characters}
\showmathcharacters

\stoptext

[-- Attachment #3: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2007-08-01  3:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31 13:28 WN
2007-08-01  3:27 ` Aditya Mahajan [this message]
2007-08-01 11:43   ` WN
2007-08-01 16:33     ` Aditya Mahajan
2007-08-02 16:28     ` Aditya Mahajan
2007-08-02 21:25       ` WN
2007-08-02 21:33         ` Aditya Mahajan
2007-08-02 21:48           ` extra math symbols and alignment (WORKS) WN
  -- strict thread matches above, loose matches on Subject: below --
2007-07-28 20:00 extra math symbols and alignment w.neimeijer

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=alpine.WNT.0.999.0707312246160.2696@nqvgln \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    --cc=wneimeijer@tiscali.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).