summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/math-def.mkiv
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
commit15995e10bfc68edf79970c4ea4fbb6678566c46e (patch)
tree2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/math-def.mkiv
parentc9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff)
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/math-def.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/math-def.mkiv144
1 files changed, 70 insertions, 74 deletions
diff --git a/Master/texmf-dist/tex/context/base/math-def.mkiv b/Master/texmf-dist/tex/context/base/math-def.mkiv
index a7e0df94030..43a511e434a 100644
--- a/Master/texmf-dist/tex/context/base/math-def.mkiv
+++ b/Master/texmf-dist/tex/context/base/math-def.mkiv
@@ -5,7 +5,7 @@
%D subtitle=Definitions,
%D author={Hans Hagen, Taco Hoekwater \& Aditya Mahajan},
%D date=\currentdate,
-%D copyright=\PRAGMA]
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
@@ -18,41 +18,25 @@
% this will be done at the lua end
\startluacode
- mathematics.define()
- mathematics.xml.registerentities()
+ mathematics.define(\number\defaultmathfamily)
+ -- mathematics.xml.registerentities()
\stopluacode
\activatemathcharacters
-% will be attributes
+% will go to math-ext (if used at all)
-\setfalse \automathpunctuation
-
-\def\enablemathpunctuation {\settrue \automathpunctuation}
-\def\disablemathpunctuation{\setfalse\automathpunctuation}
-
-\def\v!autopunctuation{autopunctuation}
-
-\appendtoks
- \doifelse{\mathematicsparameter\v!autopunctuation}\v!yes\enablemathpunctuation\disablemathpunctuation
-\to \everysetupmathematics
-
-% \appendtoks
-% \ifconditional\automathpunctuation\attribute\mathpunctuationattribute\plusone\fi
-% \to \everymathematics
-
-\setupmathematics[\v!autopunctuation=\v!yes]
-
-% will go to math-ext
-
-\Umathchardef\braceld=0 \mrfam "FF07A
-\Umathchardef\bracerd=0 \mrfam "FF07B
-\Umathchardef\bracelu=0 \mrfam "FF07C
-\Umathchardef\braceru=0 \mrfam "FF07D
+\Umathchardef\braceld=0 \defaultmathfamily "FF07A
+\Umathchardef\bracerd=0 \defaultmathfamily "FF07B
+\Umathchardef\bracelu=0 \defaultmathfamily "FF07C
+\Umathchardef\braceru=0 \defaultmathfamily "FF07D
% ctx specific
-\def\|{|} % still letter
+% \bgroup
+% \catcode`|=\othercatcode
+% \global\let\|=|
+% \egroup
% The \mfunction macro is an alternative for \hbox with a
% controlable font switch.
@@ -95,12 +79,12 @@
\definemathcommand [tanh] [nolop] {\mfunctionlabeltext{tanh}}
\definemathcommand [tan] [nolop] {\mfunctionlabeltext{tan}}
-\definemathcommand [integers] {{\mathblackboard Z}}
-\definemathcommand [reals] {{\mathblackboard R}}
-\definemathcommand [rationals] {{\mathblackboard Q}}
-\definemathcommand [naturalnumbers]{{\mathblackboard N}}
-\definemathcommand [complexes] {{\mathblackboard C}}
-\definemathcommand [primes] {{\mathblackboard P}}
+% \definemathcommand [integers] {{\mathblackboard Z}}
+% \definemathcommand [reals] {{\mathblackboard R}}
+% \definemathcommand [rationals] {{\mathblackboard Q}}
+% \definemathcommand [naturalnumbers]{{\mathblackboard N}}
+% \definemathcommand [complexes] {{\mathblackboard C}}
+% \definemathcommand [primes] {{\mathblackboard P}}
\let\normalmatharg\arg % todo: maybe automatically
@@ -122,6 +106,8 @@
\def\doleftbigmath #1{\ifx#1\relax\else\left#1\expandafter\doleftbigmath \fi}
\def\dorightbigmath#1{\ifx#1\relax\else\right.\expandafter\dorightbigmath\fi}
+\installcorenamespace{mathbig}
+
\def\choosemathbig#1#2% so we accent \big{||} as well
{{\hbox{$%
\ifcase\bigmathdelimitermethod
@@ -133,17 +119,17 @@
\dorightbigmath#2\relax
\else
\doleftbigmath#2\relax
- \vbox\!!to\getvalue{\??mm:b:\number#1}\bodyfontsize{}%
+ \vbox\!!to\getvalue{\??mathbig\number#1}\bodyfontsize{}%
\dorightbigmath#2\relax
\fi
\nulldelimiterspace\zeropoint\relax
\mathsurround\zeropoint
$}}}
-\definemathcommand [big] {\choosemathbig\plusone } \setvalue{\??mm:b:1}{0.85}
-\definemathcommand [Big] {\choosemathbig\plustwo } \setvalue{\??mm:b:2}{1.15}
-\definemathcommand [bigg] {\choosemathbig\plusthree} \setvalue{\??mm:b:3}{1.45}
-\definemathcommand [Bigg] {\choosemathbig\plusfour } \setvalue{\??mm:b:4}{1.75}
+\definemathcommand [big] {\choosemathbig\plusone } \setvalue{\??mathbig1}{0.85}
+\definemathcommand [Big] {\choosemathbig\plustwo } \setvalue{\??mathbig2}{1.15}
+\definemathcommand [bigg] {\choosemathbig\plusthree} \setvalue{\??mathbig3}{1.45}
+\definemathcommand [Bigg] {\choosemathbig\plusfour } \setvalue{\??mathbig4}{1.75}
\definemathcommand [bigl] [open] [one] {\big}
\definemathcommand [bigm] [rel] [one] {\big}
@@ -158,9 +144,7 @@
\definemathcommand [Biggm] [rel] [one] {\Bigg}
\definemathcommand [Biggr] [close] [one] {\Bigg}
-% special
-
-%AM: Optimize this! Add similar options for sums.
+%D This needs checking:
\def\setoperatorlimits#1#2% operator limits
{\savenormalmeaning{#1}%
@@ -176,7 +160,9 @@
\setoperatorlimits\ointclockwise \intlimits
\setoperatorlimits\ointctrclockwise \intlimits
-%D This is a temporary hack until we figure out how to do this correctly.
+%D This is a temporary hack until we figure out how to do this correctly,
+%D preferably using math parameters but we can also consider doing some
+%D node juggling here.
\unexpanded\def\implies {\mathrel{\;\Longrightarrow\;}}
\unexpanded\def\impliedby{\mathrel{\;\Longleftarrow\;}}
@@ -224,7 +210,7 @@
%D $\sqrt[3]{10}$
%D \stoptyping
-\def\rootradical{\Uroot 0 "221A } % can be done in char-def
+\def\rootradical{\Uroot \defaultmathfamily "221A } % can be done in char-def
\def\root#1\of{\rootradical{#1}} % #2
@@ -233,18 +219,9 @@
\def\rootwithdegree [#1]{\rootradical{#1}}
\def\rootwithoutdegree {\rootradical {}}
-\def\PLAINmatrix#1%
- {\emptyhbox\,\vcenter{\normalbaselines\mathsurround\zeropoint
- \ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
- \mathstrut\crcr\noalign{\kern-\baselineskip}
- #1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
-
\definemathcommand [mathstrut] {\vphantom{(}}
\definemathcommand [joinrel] {\mathrel{\mkern-3mu}}
-% \definemathcommand [matrix] {\PLAINmatrix}
-% \definemathcommand [over] {\normalover} % hack, to do
-
\unexpanded\def\{{\mathortext\lbrace\letterleftbrace }
\unexpanded\def\}{\mathortext\rbrace\letterrightbrace}
@@ -291,17 +268,9 @@
\definemathcommand [colonsep] {\mkern-1.2mu}
\definemathcommand [doublecolonsep] {\mkern-0.9mu}
-%D The next macro vertically centeres its contents.
-
-\def\@center@math#1%
- {\vcenter{\hbox{$\mathsurround\zeropoint#1$}}}
-
-\def\@center@colon
- {\mathpalette\@center@math{\colon}}
+%D Now we define all the colon relations .. needs checking with char-def.lua:
-%D Now we define all the colon relations.
-
-\definemathcommand [centercolon] [rel] {\@center@colon}
+\definemathcommand [centercolon] [rel] {\mathstylevcenteredhbox\colon}
\definemathcommand [colonminus] [rel] {\centercolon\colonsep\mathrel{-}}
\definemathcommand [minuscolon] [rel] {\mathrel{-}\colonsep\centercolon}
\definemathcommand [colonequals] [rel] {\centercolon\colonsep=}
@@ -323,15 +292,39 @@
%D Goodies. We might move this elsewhere.
-\def\underleftarrow #1{\mathop{\Uunderdelimiter 0 "2190 {#1}}}
-\def\overleftarrow #1{\mathop{\Uoverdelimiter 0 "2190 {#1}}}
-\def\underrightarrow#1{\mathop{\Uunderdelimiter 0 "2192 {#1}}}
-\def\overrightarrow #1{\mathop{\Uoverdelimiter 0 "2192 {#1}}}
-
-% todo: \Udelimiterover, \Udelimiterunder
-
-\def\normaldoublebrace {\Umathaccents 0 0 "23DE 0 0 "23DF }
-\def\normaldoubleparent{\Umathaccents 0 0 "23DC 0 0 "23DD }
+% Be careful in choosing what accents you take (the code below uses a
+% combining one):
+%
+% \startbuffer
+% % $\Umathaccent top 0 0 "20D7 {example}$
+% % $\Umathaccent top fixed 0 0 "20D7 {example}$
+% $\Umathaccent 0 0 "20D7 {example}$
+% $\Umathaccent fixed 0 0 "20D7 {example}$
+% $\Umathaccent bottom 0 0 "20D7 {example}$
+% $\Umathaccent bottom fixed 0 0 "20D7 {example}$
+% $\Umathaccent both 0 0 "20D7
+% 0 0 "20D7 {example}$
+% $\Umathaccent both fixed 0 0 "20D7
+% fixed 0 0 "20D7 {example}$
+% $\Umathaccent both 0 0 "20D7
+% fixed 0 0 "20D7 {example}$
+% $\Umathaccent both fixed 0 0 "20D7
+% 0 0 "20D7 {example}$
+% \stopbuffer
+%
+% \setupbodyfont[modern] \getbuffer
+% \setupbodyfont[xits] \getbuffer
+% \setupbodyfont[cambria] \getbuffer
+
+\unexpanded\def\underleftarrow #1{\mathop{\Uunderdelimiter \defaultmathfamily "2190 {#1}}}
+\unexpanded\def\overleftarrow #1{\mathop{\Uoverdelimiter \defaultmathfamily "2190 {#1}}}
+\unexpanded\def\underrightarrow#1{\mathop{\Uunderdelimiter \defaultmathfamily "2192 {#1}}}
+\unexpanded\def\overrightarrow #1{\mathop{\Uoverdelimiter \defaultmathfamily "2192 {#1}}}
+
+% watch out: here we have a class (zero):
+
+\unexpanded\def\normaldoublebrace {\Umathaccents 0 \defaultmathfamily "23DE 0 \defaultmathfamily "23DF }
+\unexpanded\def\normaldoubleparent{\Umathaccents 0 \defaultmathfamily "23DC 0 \defaultmathfamily "23DD }
\let\normaloverbrace \overbrace
\let\normalunderbrace \underbrace
@@ -356,14 +349,17 @@
\unexpanded\def\underrightarrow{\mathopwithlimits\normalunderrightarrow}
\unexpanded\def\overrightarrow {\mathopwithlimits\normaloverrightarrow }
+\let\lceil \lceiling
+\let\rceil \rceiling
+
\let\normalsurd\surd
\unexpanded\def\surd{\normalsurd{}}
% todo mathclass=punctuation ord
-% \Umathcode"02C="6 "0 "02C
-% \Umathcode"02E="0 "0 "02E
+% \Umathcode"02C="6 \defaultmathfamily "02C
+% \Umathcode"02E="0 \defaultmathfamily "02E
% tricky .. todo