diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/tex4ht/html-mml.4ht')
-rw-r--r-- | Master/texmf-dist/tex/generic/tex4ht/html-mml.4ht | 231 |
1 files changed, 223 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/generic/tex4ht/html-mml.4ht b/Master/texmf-dist/tex/generic/tex4ht/html-mml.4ht index dfe3f02138f..c33bacaa3ff 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/html-mml.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/html-mml.4ht @@ -1,23 +1,23 @@ -% html-mml.4ht (2022-10-31-13:02), generated from tex4ht-mathml.tex -% Copyright 2009-2022 TeX Users Group +% html-mml.4ht (2024-08-11-08:31), generated from tex4ht-mathml.tex +% Copyright 2009-2024 TeX Users Group % Copyright 1999-2009 Eitan M. Gurari % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3c of this license or (at your option) any % later version. The latest version of this license is in -% http://www.latex-project.org/lppl.txt +% https://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions % of LaTeX version 2005/12/01 or later. % % This work has the LPPL maintenance status "maintained". % % The Current Maintainer of this work -% is the TeX4ht Project <http://tug.org/tex4ht>. +% is the TeX4ht Project <https://tug.org/tex4ht>. % % If you modify this program, changing the % version identification would be appreciated. -\immediate\write-1{version 2022-10-31-13:02} +\immediate\write-1{version 2024-08-11-08:31} \exit:ifnot{amsmath,% array,% @@ -291,6 +291,139 @@ tex4ht} \Configure{MathjaxSource}{https://cdn.jsdelivr.net/npm/mathjax@3/es5/mml-chtml.js} \Configure{@HEAD}{\HCode{ <script type="text/javascript" id="MathJax-script" async="async" src="\a:MathjaxSource"></script> \Hnewline}} \fi +\:CheckOption{texsource}\if:Option + +\newtoks\mmleqtoks +\ExplSyntaxOn +\cs_new_protected:Npn \mmlalteqtoks #1 +{ + % save tokens, but preserve spaces + % https://tex.stackexchange.com/a/44444/2891 + \tl_set:Nn \l_tmpa_tl {#1} + \regex_replace_all:nnN { . } { \c{string} \0 } \l_tmpa_tl + \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl } + % % replace < > and & with xml entities + \regex_replace_all:nnN { \x{26} } { & } \l_tmpa_tl + \regex_replace_all:nnN { \x{3C} } { < } \l_tmpa_tl + \regex_replace_all:nnN { \x{3E} } { > } \l_tmpa_tl + % \regex_replace_all:nnN { \n } {\HCode{ \Hnewline }} \l_tmpa_tl + % replace \par command with blank lines + \regex_replace_all:nnN { \x{5C}par\b } {\x{A}\x{A}} \l_tmpa_tl + \tl_set:Nx \mmleqtoks{ \l_tmpa_tl } + + %\HCode{\l_tmpb_tl} +} +\ExplSyntaxOff + + +\def\AltMath#1${\mmlalteqtoks{#1}% + #1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation>}$} +\Configure{$}{\Configure{@math}{display="inline"}\DviMath\HCode{<\a:mathml semantics><\a:mathml mrow>}}{\HCode{</\a:mathml semantics>}\EndDviMath}{\expandafter\AltMath} + +\def\AltMathParen#1\){\mmlalteqtoks{#1}% + #1\HCode{</\a:mathml mrow><a\a:mathml nnotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation>}$} + +\def\AltMathParen#1\){\mmlalteqtoks{#1}#1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation>}\)} +%\Configure{()}{\Configure{@math}{display="inline"}\DviMath\HCode{<\a:mathml semantics><\a:mathml mrow>}\AltMathParen$}{\EndDviMath\HCode{</\a:mathml semantics>}} +\Configure{()} + {\Configure{@math}{%\a:mathml + display="inline" +}\csname a:mathml()\endcsname +\DviMath\HCode{<\a:mathml semantics><\a:mathml mrow>}$\expandafter\AltMathParen} +{$\HCode{</\a:mathml semantics>}\EndDviMath\csname b:mathml()\endcsname} + + +\long\def\AltDisplay#1\]{\mmlalteqtoks{#1}#1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation></\a:mathml semantics>}\]} +\Configure{[]}{\Configure{@math}{display="block"}\DviMath$$\DisplayMathtrue\HCode{<\a:mathml semantics><\a:mathml mrow>}\AltDisplay}{$$\EndDviMath} + + +% \long\def\MMLAltlDisplayDollars#1$${\mmlalteqtoks{\[#1\]}#1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation>}$$} + +% configuarartion of display math doesn't work yet. need to investigate it. +% \Configure{$$} +% {\Configure{@math}{%\a:mathml +% display="block" +% }\IgnorePar +% \ifvmode\else \HCode{<!--tex4ht:inline-->}\fi +% \EndP\DviMath\HCode{<\a:mathml semantics><\a:mathml mrow>}} +% {\HCode{</\a:mathml semantics>}\EndDviMath\ShowPar\par{\csname HCondtrue\endcsname\noindent}} +% {\DisplayMathtrue\expandafter\MMLAltlDisplayDollars} + + +% \renewcommand\eqannotate[1]{\mmlalteqtoks{#1}\HCode{<\a:mathml semantics><\a:mathml mrow>}#1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation></\a:mathml semantics>}} + + +% environment support +\newcommand\MMLVerbMathToks[2]{% + \mmlalteqtoks{\begin{#2} + #1 + \end{#2}}% + \begingroup% + \ifvmode\IgnorePar\fi\EndP\Configure{@math}{display="block"}\DviMath\DisplayMathtrue\HCode{<\a:mathml semantics><\a:mathml mrow>} + \Configure{$$}{}{}{} + \begin{old#2} + #1 + \end{old#2} + \HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">} + \HCode{\mmleqtoks} + \HCode{</\a:mathml annotation></\a:mathml semantics>} + \EndDviMath + \endgroup +} + +% we must handle equations separatelly. +% it is a bit messy +\newcommand\MMLVerbMathToksEquation[2]{% + \mmlalteqtoks{\begin{#2} + #1 + \end{#2}}% + \begingroup% + \def\@tempa{#2}% + \def\@equationname{equation}% + \def\mlabeledtr{mtr} + \ifx\@equationname\@tempa% + \def\mlabeledtr{mlabeledtr} % this element can be used to print the equation number, but it is supported only by MathJax + \fi + \ifvmode\IgnorePar\fi\EndP\Configure{@math}{display="block"}\DviMath\DisplayMathtrue\HCode{<\a:mathml semantics><\a:mathml mrow><\a:mathml mtable><\a:mathml \mlabeledtr><\a:mathml mtd>}% + \ifx\@equationname\@tempa% + \incr@eqnum% + \print@eqnum% + \HCode{</\a:mathml mtd><\a:mathml mtd>}% + \fi + #1% + \HCode{</\a:mathml mtd></\a:mathml \mlabeledtr></\a:mathml mtable></\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">}% + \HCode{\mmleqtoks}% + \HCode{</\a:mathml annotation></\a:mathml semantics>}% + \EndDviMath% + \endgroup% +} + +\ExplSyntaxOn +\newcommand\MMLVerbMath[1]{% + \cs_if_exist:cTF{#1}{ + \expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname + \expandafter\let\csname endold#1\expandafter\endcsname\csname end#1\endcsname + \RenewDocumentEnvironment{#1}{+!b}{% + \NoFonts\expandafter\MMLVerbMathToks\expandafter{##1}{#1}\EndNoFonts% + }{} + }{}% +} + +\newcommand\MMLVerbEquation[1]{% + \cs_if_exist:cTF{#1}{ + \expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname + \expandafter\let\csname endold#1\expandafter\endcsname\csname end#1\endcsname + \RenewDocumentEnvironment{#1}{+!b}{% + \NoFonts\expandafter\MMLVerbMathToksEquation\expandafter{##1}{#1}\EndNoFonts% + }{} + }{}% +} +\ExplSyntaxOff + +% \MMLVerbEquation{equation} +% \MMLVerbEquation{equation*} + +\fi \Configure{multicolumn} {\let\sv:VBorder\VBorder \let\VBorder\empty @@ -482,9 +615,6 @@ accent="true">&\#x0332;</\a:mathml mo></\a:mathml munder>}% - - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ConfigureHinput{amsmath} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -661,6 +791,43 @@ accent="true">&\#x0332;</\a:mathml mo></\a:mathml munder>}% \ShowPar\IgnoreIndent\par} \fi +\:CheckOption{texsource}\if:Option +\MMLVerbMath{subarray} +\MMLVerbMath{smallmatrix} +\MMLVerbMath{matrix} +\MMLVerbMath{pmatrix} +\MMLVerbMath{bmatrix} +\MMLVerbMath{Bmatrix} +\MMLVerbMath{vmatrix} +\MMLVerbMath{Vmatrix} +\MMLVerbMath{cases} +\MMLVerbMath{subequations} +\MMLVerbMath{aligned} +\MMLVerbMath{alignedat} +\MMLVerbMath{gathered} +\MMLVerbMath{gather} +\MMLVerbMath{gather*} +\MMLVerbMath{alignat} +\MMLVerbMath{alignat*} +\MMLVerbMath{xalignat} +\MMLVerbMath{xalignat*} +\MMLVerbMath{xxalignat} +\MMLVerbMath{align} +\MMLVerbMath{align*} +\MMLVerbMath{flalign} +\MMLVerbMath{flalign*} +\MMLVerbMath{split} +\MMLVerbMath{multline} +\MMLVerbMath{multline*} +% equations fails with errors, even though it worked in a .cfg +% I will need to investigate it more +% \MMLVerbEquation{equation} +% \MMLVerbEquation{equation*} +\MMLVerbMath{math} +\MMLVerbMath{displaymath} +\MMLVerbMath{eqnarray} +\MMLVerbMath{eqnarray*} +\fi \Configure{@begin} {split} {\let\tagform@=\:gobble } @@ -680,6 +847,8 @@ accent="true">&\#x0332;</\a:mathml mo></\a:mathml munder>}% + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ConfigureHinput{plain} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -831,6 +1000,8 @@ accent="true">&\#x0332;</\a:mathml mo></\a:mathml munder>}% + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ConfigureHinput{color} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -913,6 +1084,14 @@ accent="true">&\#x0332;</\a:mathml mo></\a:mathml munder>}% + + + + + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ConfigureHinput{rlbabel} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -960,6 +1139,7 @@ accent="true">&\#x0332;</\a:mathml mo></\a:mathml munder>}% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ConfigureHinput{frenchb} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1299,5 +1479,40 @@ accent="true">&\#x0332;</\a:mathml mo></\a:mathml munder>}% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \endinput |