diff options
Diffstat (limited to 'tex/context/base/math-ini.tex')
-rw-r--r-- | tex/context/base/math-ini.tex | 120 |
1 files changed, 65 insertions, 55 deletions
diff --git a/tex/context/base/math-ini.tex b/tex/context/base/math-ini.tex index 009c33df0..a18309c74 100644 --- a/tex/context/base/math-ini.tex +++ b/tex/context/base/math-ini.tex @@ -1,8 +1,8 @@ %D \module %D [ file=math-ini, -%D version=2001.04.12, +%D version=2001.04.12, %D title=\CONTEXT\ Math Macros, -%D subtitle=Basic Macros, +%D subtitle=Basic Macros, %D author={Hans Hagen \& Taco Hoekwater}, %D date=\currentdate, %D copyright=\PRAGMA] @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% todo: make all definitions global since file loaded only once + %D This module provides namespaces for math fonts, thereby %D permitting mixed usage of math fonts. Although not strictly %D needed, we also provide a family name mapping mechanism as @@ -21,13 +23,13 @@ %D fallback. We've tried to follow a couple of conventions %D from plain and AMS math in order to achieve backward %D compatinility. We also kept an eye on future usage of these -%D modules in the perspective of MathML and unicode fonts. +%D modules in the perspective of MathML and unicode fonts. \unprotect -\def\@ml@{@ml@} % math list (used for collection) +\def\@ml@{@ml@} % math list (used for collection) \def\@mf@{@mf@} % math family -%def\@mh@{@mh@} % math handler (not used) +%def\@mh@{@mh@} % math handler (not used) \def\@mt@{@mt@} % math token \def\@mc@{@mc@} % math collection @@ -45,10 +47,10 @@ \chardef\mathalphacode = 7 \let\mathalphacomm \firstofoneargument \chardef\mathinnercode = 0 \let\mathinnercomm \mathinner \chardef\mathnothingcode= 0 \let\mathnothingcomm \firstofoneargument -\chardef\mathlimopcode = 1 \let\mathlimopcomm \@@mathlimopcomm -\chardef\mathnolopcode = 1 \let\mathnolopcomm \@@mathnolopcomm -\chardef\mathchoicecode = 0 \let\mathchoicecomm \@@mathchoicecomm -\chardef\mathboxcode = 0 \let\mathboxcomm \@@mathboxcomm +\chardef\mathlimopcode = 1 \let\mathlimopcomm \@@mathlimopcomm +\chardef\mathnolopcode = 1 \let\mathnolopcomm \@@mathnolopcomm +\chardef\mathchoicecode = 0 \let\mathchoicecomm \@@mathchoicecomm +\chardef\mathboxcode = 0 \let\mathboxcomm \@@mathboxcomm \chardef\mathaccentcode = 8 \chardef\mathradicalcode= 9 @@ -73,12 +75,12 @@ \endETEX -\beginTEX +\beginTEX \def\dohandlemathtoken#1% {\csname\@mt@ \@EA\ifx\csname\@mt@\mathcollection#1\endcsname\relax - \@EA\ifx\csname\@mt@\nomathcollection#1\endcsname\relax + \@EA\ifx\csname\@mt@\nomathcollection#1\endcsname\relax \else \nomathcollection \fi @@ -89,12 +91,12 @@ \endTEX -%D Because a command can have a different meaning in math -%D and in text mode, we provide a selector. We also provide +%D Because a command can have a different meaning in math +%D and in text mode, we provide a selector. We also provide %D the pure alternatives as \type {\mathcharacter} and \type -%D {\textcharacter}. +%D {\textcharacter}. -\ifx\dohandlecommand\undefined \wait \fi % troubles ! +\ifx\dohandlecommand\undefined \wait \fi % troubles ! \let\mathcharacter\dohandlemathtoken \let\textcharacter\dohandlecommand % better \dohandletexttoken @@ -124,13 +126,13 @@ \endETEX -\beginTEX +\beginTEX \def\dohandlemathtoken#1% {\csname \ifmmode \@EA\ifx\csname\@mt@\mathcollection#1\endcsname\relax - \@EA\ifx\csname\@mt@\nomathcollection#1\endcsname\relax + \@EA\ifx\csname\@mt@\nomathcollection#1\endcsname\relax \@EA\ifx\csname\characterencoding#1\endcsname \nocharacterencoding \else @@ -153,7 +155,7 @@ \endTEX -%D Now we redefine the text encoding handler. +%D Now we redefine the text encoding handler. \let\dohandlecommand\dohandlemathtoken @@ -167,8 +169,10 @@ \setvalue{\@mf@ #1}{#2}% \fi} -\def\purefamily #1{\csname \truefamily{#1}\s!fam\endcsname} -\def\purefamilyhex#1{\csname hex\truefamily{#1}\s!fam\endcsname} +\let\mathsubfamily\empty + +\def\purefamily #1{\csname \truefamily{#1}\mathsubfamily\s!fam\endcsname} +\def\purefamilyhex#1{\csname hex\truefamily{#1}\mathsubfamily\s!fam\endcsname} \beginETEX \ifcsname @@ -204,13 +208,13 @@ \endTEX -\newif\ifdynamicmathfamilies \dynamicmathfamiliesfalse % true ? +\newif\ifdynamicmathfamilies \dynamicmathfamiliestrue % true per 2003.11.25; needed for mixed bold math \let\normalpurefamilyhex\purefamilyhex -% todo: reset collection (tok legen) en opnieuw laden met true +% todo: reset collection (tok legen) en opnieuw laden met true -\def\definemathsymbol% +\def\definemathsymbol {\dosixtupleempty\dodefinemathsymbol} \def\dodefinemathsymbol[#1][#2][#3][#4][#5][#6]% @@ -229,7 +233,7 @@ \else\iffourthargument \ifnum\puremathcode{#2}=\mathaccentcode \mathaccent\else\mathchar - \fi + \fi "\ifnum\puremathcode{#2}>7 0\else\puremathcode{#2}\fi \purefamilyhex{#3}\uchexnumbers{#4}\space \fi\fi}% @@ -335,7 +339,7 @@ \setmathcollection{#1}% \the\csname\@ml@\mathcollection\endcsname} -% hook 'm into the font mechanism +% hook 'm into the font mechanism \definefilesynonym[\f!mathprefix\s!default][\f!mathprefix tex] @@ -353,40 +357,46 @@ \fetchruntimecommand \showmathcharacters {\f!mathprefix\s!run} \fetchruntimecommand \showmathtoken {\f!mathprefix\s!run} -%D \macros -%D {ifmathpunctuation, enablemathpunctuation, +\def\resetmathcollection[#1]% + {\def\mathcollection{#1}% + \forgetdoingonce{\f!mathprefix\mathcollection}% + \setmathtoks + \ifx\mathtoks\relax\else\mathtoks\emptytoks\fi} + +%D \macros +%D {ifmathpunctuation, enablemathpunctuation, %D definemathpunctuation} %D -%D \starttypen +%D \starttypen %D \definemathpunctuation . mathperiod textperiod -%D \definemathpunctuation , mathcomma textcomma -%D \stoptypen +%D \definemathpunctuation , mathcomma textcomma +%D \stoptypen \newif\ifmathpunctuation \def\enablemathpunctuation{\mathpunctuationtrue} \def\definemathpunctuation #1 #2 #3 % - {\appendtoks + {\appendtoks \initializemathpunctuation{#1}{#2}{#3}% - \to\everymath} + \to\everymath} -\def\initializemathpunctuation#1#2#3% sloowww +\def\initializemathpunctuation#1#2#3% sloowww {\ifmathpunctuation - \mathcode`#1="8000 + \mathcode`#1="8000 \defineactivecharacter #1 {\dohandlemathpunctuation{#2}{#3}}% \fi} \unexpanded\def\dohandlemathpunctuation#1#2% \if fails in mathml interval {\def\next{\csname\ifx\space\nexttoken#2\else#1\fi\endcsname}% \futurelet\nexttoken\next} - + %D \startbuffer %D \enablemathpunctuationtrue$(1,2) (1, 2) (1{,}2) \hbox{foo, not bar}$ %D \stopbuffer -%D +%D %D \typebuffer -%D +%D %D \blanko{\getbuffer}\blanko %D needed for sin, cos etc @@ -416,39 +426,39 @@ \definefamilysynonym [default] [3] [ex] \enablemathcollection[default] - \usemathcollection[default] +\enablemathcollection[default] -%D Some goodies: +%D Some goodies: \def\Angstrom{\nomathematics{\Aring}} -%D Bold math: -%D -%D \starttypen +%D Bold math: +%D +%D \starttypen %D \usetypescript [lucida] [texnansi] -%D -%D \definetypeface [boldmath] [rm] [serif] +%D +%D \definetypeface [boldmath] [rm] [serif] %D [lucida] [default] [encoding=texnansi] -%D \definetypeface [boldmath] [tt] [mono] +%D \definetypeface [boldmath] [tt] [mono] %D [lucida] [default] [encoding=texnansi] -%D \definetypeface [boldmath] [ss] [sans] +%D \definetypeface [boldmath] [ss] [sans] %D [lucida] [default] [encoding=texnansi] -%D \definetypeface [boldmath] [mm] [boldmath] +%D \definetypeface [boldmath] [mm] [boldmath] %D [lucida] [default] [encoding=texnansi] -%D -%D \switchtobodyfont[lucida,10pt] -%D +%D +%D \switchtobodyfont[lucida,10pt] +%D %D \showmathtoken{Gamma} $\Gamma \Delta \alpha \delta \zeta$ -%D -%D \switchtobodyfont[boldmath,10pt] -%D +%D +%D \switchtobodyfont[boldmath,10pt] +%D %D \showmathtoken{Gamma} $\Gamma \Delta \alpha \delta \zeta$ -%D \stoptypen +%D \stoptypen \protect \endinput -\tracemathcollectiontrue +\tracemathcollectiontrue \input math-tex \page \setupbodyfont[ams] \enablemathcollection[ams] \input math-ams \page |