summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/x-mathml.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/x-mathml.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/x-mathml.mkiv77
1 files changed, 37 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/context/base/x-mathml.mkiv b/Master/texmf-dist/tex/context/base/x-mathml.mkiv
index 649798c9fe2..a5245c83588 100644
--- a/Master/texmf-dist/tex/context/base/x-mathml.mkiv
+++ b/Master/texmf-dist/tex/context/base/x-mathml.mkiv
@@ -28,7 +28,7 @@
\xmlfilter {\xmldocument} {omt:*/function(remapopenmath)}
\xmlfilter {\xmldocument} {mml:bind/function(remapmmlbind)}
\xmlfilter {\xmldocument} {mml:csymbol/function(remapmmlcsymbol)}
- \xmlsetsetup{\xmldocument} {mml:*} {*}
+ \xmlsetsetup{\xmldocument} {mml:*} {mml:*}
\xmlsetsetup{\xmldocument} {mml:apply/mml:apply/mml:inverse/../../..} {mml:apply:inverse}
\xmlstrip {\xmldocument} {(mml:mi|mml:mo|mml:mn|mml:mtext|mml:csymbol)}
\stopxmlsetups
@@ -38,7 +38,7 @@
\xmlregistersetup{xml:mml:define}
-\def\setupMMLappearance[#1]{\dodoubleargument\getparameters[@@MML#1]}
+\unexpanded\def\setupMMLappearance[#1]{\dodoubleargument\getparameters[@@MML#1]}
\def\MMLhack{\let\MMLpar\par \let\par\relax \everyvbox{\let\par\MMLpar}}
@@ -99,7 +99,7 @@
%D Remark: from now on this is a module and no longer an xtag
%D filter. There is an intermediate cleaner module but it has
-%D some namespace limitations. Here we do it the \MKV\ way.
+%D some namespace limitations. Here we do it the \MKIV\ way.
\def\widevec#1%
{\vbox{\mathsurround\zeropoint\ialign{##\crcr
@@ -152,7 +152,7 @@
%D In the styles, options can be set with:
-\def\setupMMLappearance[#1]{\dodoubleargument\getparameters[MML#1]} % no @@ because passed to lua
+\unexpanded\def\setupMMLappearance[#1]{\dodoubleargument\getparameters[MML#1]} % no @@ because passed to lua
%D We will apply inner math to all bits and pieces made up by an
%D \type {apply}.
@@ -334,7 +334,7 @@
\MMLcreset
\MMLdoL
\mmlfirst{#1}
- \ifnum\xmlnofelements{#1}>\plusone
+ \ifnum\xmlcount{#1}>\plusone
\negthinspace % not enough
\left(\MMLcreset\xmlconcatrange{#1}{/*}{2}{}{\MMLseparator,}\right)
\fi
@@ -354,7 +354,7 @@
\startxmlsetups mml:apply:mml:ci
\xmlfirst{#1}{/mml:ci}
- \ifnum\xmlnofelements{#1}>\plusone
+ \ifnum\xmlcount{#1}>\plusone
\left(\MMLcreset\xmlconcatrange{#1}{/*}{2}{}{\MMLseparator,}\right)
\fi
\stopxmlsetups
@@ -368,7 +368,7 @@
% fn
\startxmlsetups mmc:fn:\utfchar{"00B1} % plusminus ±
- \ifnum\xmlnofelements{#1}>\plustwo
+ \ifnum\xmlcount{#1}>\plustwo
\MMLcreset
\left(\xmlconcat{#1}{/*}{2}{}{\mmlfirst{#1}}\right)
\else
@@ -382,7 +382,7 @@
\startxmlsetups mmc:fn
\begingroup
- \edef\mmlnoffn{\xmlnofelements{#1}}
+ \edef\mmlnoffn{\xmlcount{#1}}
\ifnum\mmlnoffn>\plustwo
\def\MMCfnleft {\left(}
\def\MMCfnright{\right)}
@@ -428,7 +428,7 @@
} {
\MMLcreset
\mmlfirst{#1}
- \ifnum\xmlnofelements{#1}>\plusone
+ \ifnum\xmlcount{#1}>\plusone
\negthinspace
\left(\MMLcreset\xmlconcat{#1}{2}{}{\MMLseparator,}\right)
\fi
@@ -550,10 +550,6 @@
\xmlsetup{#1}{mml:cn:polar}
\stopxmlsetups
-% \doif\MMLcnalternative\v!b{\redefinemathcharacter [.][ord][mi]["3B]\relax}%
-%
-% todo: number function from mmp
-
% helpers ci
\startxmlsetups mml:cn:default
@@ -759,7 +755,7 @@
\doif \MMLdeclarestate \v!start {
\mathopnolimits{declare}
\mmlfirst{#1}
- \ifnum\xmlnofelements{#1}>\plusone
+ \ifnum\xmlcount{#1}>\plusone
\thickspace
\mathopnolimits{as}
\thickspace
@@ -1361,12 +1357,6 @@
}
\stopxmlsetups
-% option: to be discussed with taco/aditya: all math functions \mathentity
-%
-% \defineXMLentity [div] {\mathematics{\triangledown\times}}
-% \defineXMLentity [curl] {\mathematics{\triangledown .}}
-% \defineXMLentity [grad] {\mathematics{\triangledown }}
-
\startxmlsetups mml:divergence \mathopnolimits{div} \xmlall{#1}{/!mml:divergence} \stopxmlsetups
\startxmlsetups mml:grad \mathopnolimits{grad} \xmlall{#1}{/!mml:grad} \stopxmlsetups
\startxmlsetups mml:curl \mathopnolimits{curl} \xmlall{#1}{/!mml:curl} \stopxmlsetups
@@ -1595,7 +1585,7 @@
\startxmlsetups mml:vector
\begingroup
- \ifnum\xmlnofelements{#1}>\plusone
+ \ifnum\xmlcount{#1}>\plusone
\doifelse\MMLvectordirection\v!horizontal {
\left(\xmlconcat{#1}{/*}{\MMLseparator\MMLvectorseparator}\right)
} {
@@ -1664,18 +1654,24 @@
\stopxmlsetups
\usemodule[x][calcmath]
+%usemodule[x][asciimath]
\startxmlsetups mml:annotation
- \xmldoifelse {#1} {[oneof(@encoding,'TeX','tex','TEX','ConTeXt','context','CONTEXT','ctx')]} {
- \begingroup
- \setcatcodetable\ctxcatcodes
- \xmlflush{#1}
- \endgroup
+ \xmldoifelse {#1} {.[oneof(@encoding,'TeX','tex','TEX','ConTeXt','context','CONTEXT','ctx')]} {
+ \xmlflushcontext{#1}
} {
- \xmldoifelse {#1} {[oneof(@encoding,'calcmath','cm')]} {
- \calcmath{\xmlflush{#1}}
+ \xmldoifelse {#1} {.[oneof(@encoding,'calcmath','cm')]} {
+ \expanded{\calcmath{\xmlflush{#1}}}
} {
- \xmlall{#1}{../!mml:annotation}
+ \xmldoifelse {#1} {.[oneof(@encoding,'asciimath','am')]} {
+ \ifdefined\asciimath
+ \expanded{\asciimath{\xmlflush{#1}}}
+ \else
+ \hbox{\tt no am loaded}%
+ \fi
+ } {
+ \xmlall{#1}{../!mml:annotation}
+ }
}
}
\stopxmlsetups
@@ -1852,12 +1848,12 @@
% setups
\startxmlsetups mml:mi % todo: mathvariant mathsize mathcolor mathbackground
- \ctxlua{lxml.mml.mi("#1","*")}
+ \ctxlua{lxml.mml.mi("#1")}
\stopxmlsetups
\startxmlsetups mml:mn % todo: mathvariant mathsize mathcolor mathbackground
\begingroup
- \mr \ctxlua{lxml.mml.mn("#1","*")}% no \hbox, would be ok for . , but spoils rest
+ \mr \ctxlua{lxml.mml.mn("#1")}% no \hbox, would be ok for . , but spoils rest
\endgroup
\stopxmlsetups
@@ -1868,7 +1864,7 @@
\startxmlsetups mml:mo
\doif {\xmlatt{#1}{maxsize}} {1} {\settrue\mmlignoredelimiter}
\doif {\xmlatt{#1}{stretchy}} {false} {\settrue\mmlignoredelimiter}
- \ctxlua{lxml.mml.mo("#1","*")}
+ \ctxlua{lxml.mml.mo("#1")}
\setfalse\mmlignoredelimiter
\stopxmlsetups
@@ -1876,7 +1872,7 @@
\def\MMLleft {\left }% weird
\def\MMLright {\right}
\def\MMLmiddle{\middle}
- \ctxlua{lxml.mml.mfenced("#1","/*")}
+ \ctxlua{lxml.mml.mfenced("#1")}
\stopxmlsetups
\defineoverlay [mml:enclose:box] [\useMPgraphic{mml:enclose:box}]
@@ -2080,8 +2076,9 @@
\startxmlsetups mml:mrow
\begingroup
- \ifnum\xmlcount{#1}{/mml:mo}=\plustwo
- \xmldoifelse {#1} {/mml:mo[position()==1 or position()==\xmlnofelements{#1}]} {% we need a {}
+ \edef\nofmmlrows{\xmlcount{#1}{/mml:mo}}%
+ \ifnum\nofmmlrows=\plustwo
+ \xmldoifelse {#1} {/mml:mo[position()==1 or position()==\nofmmlrows]} {% we need a {}
\def\MMLleft {\left }
\def\MMLright {\right}
\def\MMLmiddle{\middle}
@@ -2146,12 +2143,12 @@
\startxmlsetups mml:mover
% \mathop {
- \edef\mmlovertoken{\xmlraw{#1}{/mml:*[position()==2]}}
+ \edef\mmlovertoken{\xmlraw{#1}{/mml:*[2]}}
\doifelse{\utfmathclass\mmlovertoken}{accent} {
\edef\mmlovercommand{\utfmathcommand\mmlovertoken}
\mmlexecuteifdefined\mmlovercommand\mathematics{\mmlfirst{#1}}
} {
- \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[position()==1]}}
+ \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}}
\edef\mmlbasecommand{\utfmathfiller\mmlbasetoken}
\edef\mmlovercommand{\utfmathfiller\mmlovertoken}
\vbox {
@@ -2170,12 +2167,12 @@
\startxmlsetups mml:munder
% \mathop {
- \edef\mmlundertoken{\xmlraw{#1}{/mml:*[position()==2]}}
+ \edef\mmlundertoken{\xmlraw{#1}{/mml:*[2]}}
\doifelse{\utfmathclass\mmlundertoken}{accent} {
\edef\mmlundercommand{\utfmathcommand\mmlundertoken}
\mmlexecuteifdefined\mmlundercommand\mathematics{\mmlfirst{#1}}
} {
- \edef\mmlbasetoken {\xmlraw{#1}{/mml:*[position()==1]}}
+ \edef\mmlbasetoken {\xmlraw{#1}{/mml:*[1]}}
\edef\mmlbasecommand {\utfmathfiller\mmlbasetoken}
\edef\mmlundercommand{\utfmathfiller\mmlundertoken}
\vtop {
@@ -2193,7 +2190,7 @@
\stopxmlsetups
\startxmlsetups mml:munderover
- \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[position()==1]}}
+ \edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}}
\edef\mmlbasecommand{\utfmathcommand\mmlbasetoken}
\mmlexecuteifdefined\mmlbasecommand{\mathematics{\mmlfirst{#1}}}_{\mmlsecond{#1}}^{\mmlthird{#1}}
\stopxmlsetups