summaryrefslogtreecommitdiff
path: root/support/TeX4ht/source/tex4ht-mathml.tex
diff options
context:
space:
mode:
Diffstat (limited to 'support/TeX4ht/source/tex4ht-mathml.tex')
-rw-r--r--support/TeX4ht/source/tex4ht-mathml.tex19
1 files changed, 11 insertions, 8 deletions
diff --git a/support/TeX4ht/source/tex4ht-mathml.tex b/support/TeX4ht/source/tex4ht-mathml.tex
index 74132b6ac0..68ed7dfddc 100644
--- a/support/TeX4ht/source/tex4ht-mathml.tex
+++ b/support/TeX4ht/source/tex4ht-mathml.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-mathml.tex 1463 2024-02-19 13:33:57Z michal_h21 $$
+% $Id: tex4ht-mathml.tex 1464 2024-02-21 09:46:01Z michal_h21 $$
% compile 3 times: latex tex4ht-mathltx
% or xhlatex tex4ht-mathltx "html,3,sections+"
%
@@ -5518,23 +5518,26 @@ with small shifting.
\Configure{mhchemcf}{\HCode{<\:mhmathmlorhtml{mrow}{span}\space class="mhchem-cf">}}{\HCode{</\:mhmathmlorhtml{mrow}{span}>}}
\Configure{mhchemce}{\HCode{<\:mhmathmlorhtml{mrow}{span}\space class="mhchem-ce">}}{\HCode{</\:mhmathmlorhtml{mrow}{span}>}}
+% we configure subscripts and superscripts to have empty bases. it is because if superscript followed subscript, we got wrong
+% MathML markup, with mismatched tags. For example: \ce{CrO4^2-}
\Configure{mhchemsub}{%
\:mhmathmlorhtml{%
- \Send{BACK}%
- {<\a:mathml msub><\a:mathml mrow\Hnewline>}%
- \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base%
+ \HCode{<\a:mathml msub><mrow></mrow><\a:mathml mrow>}%
}{%
\HCode{<sub>}}%
-}{\:mhmathmlorhtml{\Tg</\a:mathml mrow>\TG</\a:mathml msub\Hnewline>}{\HCode{</sub>}}}
+}{\:mhmathmlorhtml{\Tg</\a:mathml mrow>\TG</\a:mathml msub>}{\HCode{</sub>}}}
\Configure{mhchemsup}{%
\:mhmathmlorhtml{
- \Send{BACK}
- {<\a:mathml msup><\a:mathml mrow\Hnewline>}%
- \Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base
+ \HCode{<\a:mathml msup><mrow></mrow><\a:mathml mrow>}%
}{%
\HCode{<sup>}}%
}{\:mhmathmlorhtml{\Tg</\a:mathml mrow>\TG</\a:mathml msup\Hnewline>}{\HCode{</sup>}}}
+
+\Configure{mhchemsupsub}{\setbox0=\hbox\bgroup}{\egroup\setbox1=\hbox\bgroup}{\egroup\HCode{<\a:mathml msubsup><\a:mathml mrow></\a:mathml mrow><\a:mathml mrow>}\box1\HCode{</\a:mathml mrow><\a:mathml mrow>}\box0\HCode{</\a:mathml mrow></\a:mathml msubsup>}}
+\Configure{mhchemisotope}{\setbox0=\hbox\bgroup}{\egroup\setbox1=\hbox\bgroup}{\egroup\HCode{<\a:mathml msubsup><\a:mathml mrow></\a:mathml mrow><\a:mathml mrow>}\box1\HCode{</\a:mathml mrow><\a:mathml mrow>}\box0\HCode{</\a:mathml mrow></\a:mathml msubsup>}}
+
+
% mhchemoperator is always used inside \HCode, so we need not to use \HCode in it's configuration
\Configure{mhchemoperator}{<\:mhmathmlorhtml{mo}{span} class="mhchem-operator">}{</\:mhmathmlorhtml{mo}{span}>}