ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: extra math symbols and alignment
@ 2007-07-31 13:28 WN
  2007-08-01  3:27 ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: WN @ 2007-07-31 13:28 UTC (permalink / raw)
  To: Aditya Mahajan, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1114 bytes --]

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.

Hope you can find a solution.
Kind regards
Wim


[-- Attachment #1.2: Type: text/html, Size: 1377 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: extra math symbols and alignment
  2007-07-31 13:28 extra math symbols and alignment WN
@ 2007-08-01  3:27 ` Aditya Mahajan
  2007-08-01 11:43   ` WN
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2007-08-01  3:27 UTC (permalink / raw)
  To: WN; +Cc: mailing list for ConTeXt users

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: extra math symbols and alignment
  2007-08-01  3:27 ` Aditya Mahajan
@ 2007-08-01 11:43   ` WN
  2007-08-01 16:33     ` Aditya Mahajan
  2007-08-02 16:28     ` Aditya Mahajan
  0 siblings, 2 replies; 9+ messages in thread
From: WN @ 2007-08-01 11:43 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 3633 bytes --]

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


[-- Attachment #2: testalignfont.tex --]
[-- Type: text/x-tex, Size: 5034 bytes --]

\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


[-- Attachment #3: texnansi-wim-rsfs.map --]
[-- Type: text/plain, Size: 383 bytes --]

% 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

[-- Attachment #4: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: extra math symbols and alignment
  2007-08-01 11:43   ` WN
@ 2007-08-01 16:33     ` Aditya Mahajan
  2007-08-02 16:28     ` Aditya Mahajan
  1 sibling, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2007-08-01 16:33 UTC (permalink / raw)
  To: WN; +Cc: mailing list for ConTeXt users

Quoting WN <wneimeijer@tiscali.nl>:

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

Ok. I will test this to see what is happening. (I do not have an 
uptodate context on this machine).

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

I am out of depths here. I do not really understand how math fonts are 
handled. The wiki example was modified from a suggestion from Taco. For 
rsfs, you can go to the plain tex way of doing things also.

Aditya

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


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: extra math symbols and alignment
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2007-08-02 16:28 UTC (permalink / raw)
  To: WN; +Cc: mailing list for ConTeXt users

Hi Wim,

Quoting WN <wneimeijer@tiscali.nl>:

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

:-) Section modifies \!!counta so things get messed up again. Actually, 
this really helped to narrow down the bug. Basically, dostartmatrix 
does a test

\scratchcounter=\ifnum\eqaligncolumn>\scratchcounter \eqaligncolumn 
\else \plusone \fi

which is comparing eqaligncolmn with scratch counter, but 
scratchcounter is never initialized. Therefore, everything depends on 
what was the value of scratchcounter, which explains, different 
behaviour depending on when the matrix  occurred, and why you had a 
hard time pinning down a minimal example.

The fix is easy, change the scratchcounter to zerocount (or maybe just 
change to \ifcase\eqaligncolunm). So add this to your file,

\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 
\processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}%
   \scratchcounter=\ifnum\eqaligncolumn>\zerocount \eqaligncolumn \else 
\plusone \fi
   \global\eqaligncolumn\plusone
   \preparemathmatrix } % uses scratchcounter
\protect


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: extra math symbols and alignment
  2007-08-02 16:28     ` Aditya Mahajan
@ 2007-08-02 21:25       ` WN
  2007-08-02 21:33         ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: WN @ 2007-08-02 21:25 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3245 bytes --]

Hi Aditya

I tried the new code you send me, and of course I did a quick test.
But when doing a texmfstart texexec --autopdf --pdf testalignfontnew.tex
texexec hangs ''forever''  while trying to process the \section{} command.
Actually its pdftex trying to do something.

To make sure I did not make a edit mistake, I copied my old test code into
the file testalignfontnew.tex and run a diff to see where the difference 
with the new code
are.

Looking at the code (and I am not a Tex expert, and forgive me, when I 
ask a dumb question)
I don't see where the \scratchcounter itself is defined ? Must surely be 
a global Context counter ?

Attached the new test code.
Hope it helps the debugging process and thanks for all your help sofar.

Wim

> Hi Wim,
>
> Quoting WN <wneimeijer@tiscali.nl>:
>
>   
>> 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.
>>     
>
> :-) Section modifies \!!counta so things get messed up again. Actually, 
> this really helped to narrow down the bug. Basically, dostartmatrix 
> does a test
>
> \scratchcounter=\ifnum\eqaligncolumn>\scratchcounter \eqaligncolumn 
> \else \plusone \fi
>
> which is comparing eqaligncolmn with scratch counter, but 
> scratchcounter is never initialized. Therefore, everything depends on 
> what was the value of scratchcounter, which explains, different 
> behaviour depending on when the matrix  occurred, and why you had a 
> hard time pinning down a minimal example.
>
> The fix is easy, change the scratchcounter to zerocount (or maybe just 
> change to \ifcase\eqaligncolunm). So add this to your file,
>
> \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 
> \processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}%
>    \scratchcounter=\ifnum\eqaligncolumn>\zerocount \eqaligncolumn \else 
> \plusone \fi
>    \global\eqaligncolumn\plusone
>    \preparemathmatrix } % uses scratchcounter
> \protect
>
>
> Aditya
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
>
>   


[-- Attachment #1.2: Type: text/html, Size: 4180 bytes --]

[-- Attachment #2: testalignfontnew.tex --]
[-- Type: text/x-tex, Size: 5024 bytes --]

\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
\processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}%
   \scratchcounter=\ifnum\eqaligncolumn>\zerocount \eqaligncolumn \else \plusone \fi
   \global\eqaligncolumn\plusone
   \preparemathmatrix } % uses scratchcounter

\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


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: extra math symbols and alignment
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2007-08-02 21:33 UTC (permalink / raw)
  To: WN; +Cc: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]

Hi Wim,

Quoting WN <wneimeijer@tiscali.nl>:

> I tried the new code you send me, and of course I did a quick test.
> But when doing a texmfstart texexec --autopdf --pdf testalignfontnew.tex
> texexec hangs ''forever''  while trying to process the \section{} command.
> Actually its pdftex trying to do something.
>
> To make sure I did not make a edit mistake, I copied my old test code into
> the file testalignfontnew.tex and run a diff to see where the 
> difference with the new code
> are.
>
> Looking at the code (and I am not a Tex expert, and forgive me, when 
> I ask a dumb question)
> I don't see where the \scratchcounter itself is defined ? Must surely 
> be a global Context counter ?

Yes. \scratchcounter is defined in syst-gen (IIRC). So are a bunch of 
other temporary variables.

> Attached the new test code.
> Hope it helps the debugging process and thanks for all your help sofar.

I can not really check the font stuff, since I do not have txfonts and 
rsfs on this machine. But the matrix alignment appears to be working 
fine. I am attaching the test for just the matrix alignment. When I get 
home, I will try to see what goes wrong when you add other fonts.

Aditya

[-- Attachment #2: test2.tex --]
[-- Type: text/plain, Size: 2459 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
   \processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}%
   \scratchcounter=\ifnum\eqaligncolumn>\zerocount \eqaligncolumn \else \plusone \fi
   \global\eqaligncolumn\plusone
   \preparemathmatrix } % uses scratchcounter
\protect

\definetypeface[mainface] [rm]   [serif]  [times]     [default]  [encoding=texnansi]
\definetypeface[mainface] [mm] [math] [modern] [modern] [encoding=texnansi]
\setupbodyfont[mainface,11pt]

\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

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: extra math symbols and alignment (WORKS)
  2007-08-02 21:33         ` Aditya Mahajan
@ 2007-08-02 21:48           ` WN
  0 siblings, 0 replies; 9+ messages in thread
From: WN @ 2007-08-02 21:48 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

Hi Aditya,

You don't have to check the font stuff. Everything works (alignment and 
the fonts) :-)
Thanks for your all help.

Wim
> Hi Wim,
>
> Quoting WN <wneimeijer@tiscali.nl>:
>
>> I tried the new code you send me, and of course I did a quick test.
>> But when doing a texmfstart texexec --autopdf --pdf testalignfontnew.tex
>> texexec hangs ''forever''  while trying to process the \section{} 
>> command.
>> Actually its pdftex trying to do something.
>>
>> To make sure I did not make a edit mistake, I copied my old test code 
>> into
>> the file testalignfontnew.tex and run a diff to see where the 
>> difference with the new code
>> are.
>>
>> Looking at the code (and I am not a Tex expert, and forgive me, when 
>> I ask a dumb question)
>> I don't see where the \scratchcounter itself is defined ? Must surely 
>> be a global Context counter ?
>
> Yes. \scratchcounter is defined in syst-gen (IIRC). So are a bunch of 
> other temporary variables.
>
>> Attached the new test code.
>> Hope it helps the debugging process and thanks for all your help sofar.
>
> I can not really check the font stuff, since I do not have txfonts and 
> rsfs on this machine. But the matrix alignment appears to be working 
> fine. I am attaching the test for just the matrix alignment. When I 
> get home, I will try to see what goes wrong when you add other fonts.
>
> Aditya

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* extra math symbols and alignment
@ 2007-07-28 20:00 w.neimeijer
  0 siblings, 0 replies; 9+ messages in thread
From: w.neimeijer @ 2007-07-28 20:00 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

Hello,

I am trying to extend the standard math collection with some symbols from
the Ralph Smith Formal font and some extra integral symbols from the txexa
font. I used the example from http://wiki.contextgarden.net/rsfs.

The problems I am having is
1) Some of the standard math symbols are overwritten as
shown by \showmathcharacters.
2) Alignment of left,right and middle is not working when I use matrices.

I really hope someone can help me.
Attached some test code.

Kind regards

Wim

[-- Attachment #2: testalignfont.tex --]
[-- Type: application/x-tex, Size: 3839 bytes --]

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-08-02 21:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-31 13:28 extra math symbols and alignment WN
2007-08-01  3:27 ` Aditya Mahajan
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

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).