diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv | 196 |
1 files changed, 121 insertions, 75 deletions
diff --git a/Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv b/Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv index bd55196f9d3..a8b121053a8 100644 --- a/Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv +++ b/Master/texmf-dist/tex/context/modules/mkiv/x-mathml.mkiv @@ -393,12 +393,12 @@ % \fi % \MMLdoR % } { - \edef\mmlapplyaction{\xmlfilter{#1}{/*/name()}} + \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}} \doifelsesetups {mml:apply:mml:\mmlapplyaction} { \xmlsetup{#1}{mml:apply:mml:\mmlapplyaction} } { % \MMLdoL - \xmlsetup{#1}{mml:\xmlfilter{#1}{/*/name()}} + \xmlsetup{#1}{mml:\mmlapplyaction} % \MMLdoR } % } @@ -472,41 +472,41 @@ \startxmlsetups mmc:fn \begingroup - \edef\mmlnoffn{\xmlcount{#1}{/*}} - \ifnum\mmlnoffn>\plustwo - \def\MMCfnleft {\left(} - \def\MMCfnright{\right)} - \else - \let\MMCfnleft \relax - \let\MMCfnright\relax - \fi - \xmldoifelse {#1} {/mml:ci} { % first - \edef\mmlfnci{\xmltext{#1}{/mml:ci}}% was xmlcontent - \doifelsesetups{mmc:fn:\mmlfnci} { % was mmc:fn:... - \xmlsetup{#1}{mmc:fn:\mmlfnci} % \MMLdoL/MMLdoR to be handled in plugin - } { - \MMLcreset - \mmlfirst{#1} - } - } { - \xmldoifelse {#1} {/mml:apply} { % first - \xmldoifelse {#1} {/(mml:plus\string|mml:minus)} { - \left(\mmlfirst{#1}\right) + \edef\mmlnoffn{\xmlcount{#1}{/*}} + \ifnum\mmlnoffn>\plustwo + \def\MMCfnleft {\left(} + \def\MMCfnright{\right)} + \else + \let\MMCfnleft \relax + \let\MMCfnright\relax + \fi + \xmldoifelse {#1} {/mml:ci} { % first + \edef\mmlfnci{\xmltext{#1}{/mml:ci}}% was xmlcontent + \doifelsesetups{mmc:fn:\mmlfnci} { % was mmc:fn:... + \xmlsetup{#1}{mmc:fn:\mmlfnci} % \MMLdoL/MMLdoR to be handled in plugin } { + \MMLcreset \mmlfirst{#1} } - \ifnum\mmlnoffn>\plusone - \left(\xmlall{#1}{/!mml:apply}\right) - \fi } { - \MMLcreset - \negthinspace - \MMCfnleft - \ifnum\mmlnoffn=\plustwo,\fi - \xmlconcat{#1}{/*}{2}{}{\MMLseparator,} - \MMCfnright + \xmldoifelse {#1} {/mml:apply} { % first + \xmldoifelse {#1} {/(mml:plus\string|mml:minus)} { + \left(\mmlfirst{#1}\right) + } { + \mmlfirst{#1} + } + \ifnum\mmlnoffn>\plusone + \left(\xmlall{#1}{/!mml:apply}\right) + \fi + } { + \MMLcreset + \negthinspace + \MMCfnleft + \ifnum\mmlnoffn=\plustwo,\fi + \xmlconcat{#1}{/*}{2}{}{\MMLseparator,} + \MMCfnright + } } - } \endgroup \stopxmlsetups @@ -670,7 +670,7 @@ \stopxmlsetups \startxmlsetups mml:cn:polar:a - \ctxmodulemathml{cpolar_a("#1")} + \ctxmodulemathml{cpolar("#1")} \stopxmlsetups \startxmlsetups mml:cn:polar:b @@ -797,7 +797,7 @@ \startxmlsetups mml:apply:inverse \settrue\xmlinversefunction - \xmlsetup{#1}{mml:\xmlfilter{#1}{/mml:apply/*[2]/name()}} + \xmlsetup{#1}{mml:\xmlfilter{#1}{/mml:apply/*[2]/tag()}} \stopxmlsetups % condition @@ -1219,7 +1219,7 @@ \startxmlsetups mml:factorof \xmlsetup{#1}{mml:relation} \stopxmlsetups \startxmlsetups mml:relation - \edef\mmlapplyaction{\xmlfilter{#1}{/*/name()}} + \edef\mmlapplyaction{\xmlfilter{#1}{/*/tag()}} \MMLcreset \xmlsetup{#1}{mml:relation:\xmlattdef{#1}{align}{\MMLrelationalign}} \stopxmlsetups @@ -1879,6 +1879,14 @@ \fi \stoptexdefinition +\starttexdefinition setmmlmathcolor #1 + \edef\mmlmathcolor{\xmlatt{#1}{mathcolor}} + \ifx \mmlmathcolor \empty + \else + \directcolor[\mmlmathcolor] + \fi +\stoptexdefinition + % todo: textbackgrounds \starttexdefinition applymmlmathbackground #1#2 @@ -1922,16 +1930,20 @@ \startxmlsetups mml:mi % todo: mathsize (unlikely) mathcolor (easy) mathbackground (easy) \begingroup - \pushmathstyle + \pushmathstyle % still needed ? + \setmmlmathcolor{#1} \setmmlmathstyle{#1} \setmmlscriptlevel{#1} \ctxmodulemathml{mi("#1")} - \popmathstyle + \popmathstyle % still needed ? \endgroup \stopxmlsetups \startxmlsetups mml:mn - \ctxmodulemathml{mn("#1")}% no \hbox, would be ok for . , but spoils rest + \begingroup + \setmmlmathcolor{#1} + \ctxmodulemathml{mn("#1")}% no \hbox, would be ok for . , but spoils rest + \endgroup \stopxmlsetups % <m:mo>-</m:mo><m:mn>2</m:mn> and <m:mn>1</m:mn><m:mo>-</m:mo><m:mn>2</m:mn> @@ -1939,25 +1951,28 @@ % spacing between - and 2 is taken care of by tex itself \startxmlsetups mml:mo - \edef\mmlattvalue{\xmlatt{#1}{maxsize}} - \ifx\mmlattvalue\mmlconstantone - \settrue\mmlignoredelimiter - \else - \edef\mmlattvalue{\xmlatt{#1}{stretchy}} - \ifx\mmlattvalue\mmlconstantfalse + \begingroup + \setmmlmathcolor{#1} + \edef\mmlattvalue{\xmlatt{#1}{maxsize}} + \ifx\mmlattvalue\mmlconstantone \settrue\mmlignoredelimiter + \else + \edef\mmlattvalue{\xmlatt{#1}{stretchy}} + \ifx\mmlattvalue\mmlconstantfalse + \settrue\mmlignoredelimiter + \fi \fi - \fi - \edef\mmlattvalue{\xmlatt{#1}{lspace}} - \ifx\mmlattvalue\empty\else - \hskip\mmlattvalue\relax % todo: check for dimension - \fi - \ctxmodulemathml{mo("#1")} - \edef\mmlattvalue{\xmlatt{#1}{rspace}} - \ifx\mmlattvalue\empty\else - \hskip\mmlattvalue\relax % todo: check for dimension - \fi - \setfalse\mmlignoredelimiter + \edef\mmlattvalue{\xmlatt{#1}{lspace}} + \ifx\mmlattvalue\empty\else + \hskip\mmlattvalue\relax % todo: check for dimension + \fi + \ctxmodulemathml{mo("#1")} + \edef\mmlattvalue{\xmlatt{#1}{rspace}} + \ifx\mmlattvalue\empty\else + \hskip\mmlattvalue\relax % todo: check for dimension + \fi + % \setfalse\mmlignoredelimiter + \endgroup \stopxmlsetups @@ -2486,34 +2501,65 @@ \setupMMLappearance[mspace][\c!option=] % \v!test +% \startxmlsetups mml:mspace +% \begingroup +% \edef\mmlspacetext{\xmlatt{#1}{spacing}} +% \ifx\mmlspacetext\empty +% \scratchwidth \xmlattdef{#1}{width} \!!zeropoint % must be string +% \scratchheight\xmlattdef{#1}{height}\!!zeropoint +% \scratchdepth \xmlattdef{#1}{depth} \!!zeropoint +% \ifdim\scratchheight=\zeropoint +% \ifdim\scratchdepth=\zeropoint\else +% \hbox{\vrule\s!depth\scratchdepth\s!height\zeropoint\s!width\zeropoint}% +% \fi +% \else +% \hbox{\vrule\s!depth\zeropoint\s!height\scratchheight\s!width\zeropoint}% +% \fi +% \ifdim\scratchwidth=\zeropoint\else +% \ifx\MMLmspaceoption\v!test +% \hbox to \scratchwidth{\showstruts\strut\hss\lower2\exheight\hbox{\infofont\xmlattdef{#1}{width}}\hss\strut} +% \else +% \hskip\scratchwidth +% \fi +% \fi +% \else +% \ifx\MMLmspaceoption\v!test +% \hbox{\showstruts\strut\phantom{\triggermathstyle\normalmathstyle\mmlspacetext}\strut} +% \else +% \phantom{\triggermathstyle\normalmathstyle\mmlspacetext} +% \fi +% \fi +% \endgroup +% \stopxmlsetups + \startxmlsetups mml:mspace \begingroup - \edef\mmlspacetext{\xmlatt{#1}{spacing}} - \ifx\mmlspacetext\empty - \scratchwidth \xmlattdef{#1}{width} \!!zeropoint % must be string - \scratchheight\xmlattdef{#1}{height}\!!zeropoint - \scratchdepth \xmlattdef{#1}{depth} \!!zeropoint - \ifdim\scratchheight=\zeropoint - \ifdim\scratchdepth=\zeropoint\else - \hbox{\vrule\s!depth\scratchdepth\s!height\zeropoint\s!width\zeropoint}% + \edef\mmlspacetext{\xmlatt{#1}{spacing}} + \ifx\mmlspacetext\empty + \scratchwidth \xmlattdef{#1}{width} \!!zeropoint % must be string + \scratchheight\xmlattdef{#1}{height}\!!zeropoint + \scratchdepth \xmlattdef{#1}{depth} \!!zeropoint + \ifdim\scratchheight=\zeropoint + \ifdim\scratchdepth=\zeropoint\else + \novrule\s!depth\scratchdepth\s!height\zeropoint\s!width\zeropoint + \fi + \else + \novrule\s!depth\zeropoint\s!height\scratchheight\s!width\zeropoint + \fi + \ifdim\scratchwidth=\zeropoint\else + \ifx\MMLmspaceoption\v!test + \hbox to \scratchwidth{\showstruts\strut\hss\lower2\exheight\hbox{\infofont\xmlattdef{#1}{width}}\hss\strut} + \else + \hskip\scratchwidth + \fi \fi \else - \hbox{\vrule\s!depth\zeropoint\s!height\scratchheight\s!width\zeropoint}% - \fi - \ifdim\scratchwidth=\zeropoint\else \ifx\MMLmspaceoption\v!test - \hbox to \scratchwidth{\showstruts\strut\hss\lower2\exheight\hbox{\infofont\xmlattdef{#1}{width}}\hss\strut} + \hbox{\showstruts\strut\phantom{\triggermathstyle\normalmathstyle\mmlspacetext}\strut} \else - \hskip\scratchwidth + \phantom{\triggermathstyle\normalmathstyle\mmlspacetext} \fi \fi - \else - \ifx\MMLmspaceoption\v!test - \hbox{\showstruts\strut\phantom{\triggermathstyle\normalmathstyle\mmlspacetext}\strut} - \else - \phantom{\triggermathstyle\normalmathstyle\mmlspacetext} - \fi - \fi \endgroup \stopxmlsetups |