[tex4ht-commits] [SCM] tex4ht updated: r1464 - trunk/lit

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Wed Feb 21 10:46:01 CET 2024


Author: michal_h21
Date: 2024-02-21 09:46:01 +0000 (Wed, 21 Feb 2024)
New Revision: 1464

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
   trunk/lit/tex4ht-html4.tex
   trunk/lit/tex4ht-mathml.tex
Log:
fixed some issues with mhchem subscripts and superscritps

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2024-02-19 13:33:57 UTC (rev 1463)
+++ trunk/lit/ChangeLog	2024-02-21 09:46:01 UTC (rev 1464)
@@ -1,3 +1,10 @@
+2024-02-21  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (mhchem.4ht),
+	* tex4ht-mathml.tex (mathml.4ht),
+	* tex4ht-html4.tex (html4.4ht): fixed some issues with Mhchem
+	superscripts and subscripts.
+
 2024-02-19  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-mathml.tex (mathml.4ht): fixed rendering of

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2024-02-19 13:33:57 UTC (rev 1463)
+++ trunk/lit/tex4ht-4ht.tex	2024-02-21 09:46:01 UTC (rev 1464)
@@ -30838,6 +30838,8 @@
 
 \NewConfigure{mhchemsup}{2}
 
+\NewConfigure{mhchemsupsub}{3}
+
 \cs_set_protected:Npn \__mhchem_output_coreFivefourht:nnnnnnn #1#2#3#4#5#6#7
   {
     \bool_if:nT
@@ -30872,11 +30874,11 @@
                 \b:mhchemsup
               }
               { 
-              	\HCode { <span~class="mhchem-supsub"> }
+                \a:mhchemsupsub
               	\__mhchem_output_withFont:n { #4#5#7 }
-              	\HCode { <br~/>&\#xfeff; }
+                \c:mhchemsupsub
               	\__mhchem_output_withFont:n { #6 }
-              	\HCode { </span> } 
+                \b:mhchemsupsub
              }
           }
       }

Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex	2024-02-19 13:33:57 UTC (rev 1463)
+++ trunk/lit/tex4ht-html4.tex	2024-02-21 09:46:01 UTC (rev 1464)
@@ -21757,7 +21757,6 @@
 %%%%%%%%%%%%%%%%%%%%%
 
 \<configure html4 mhchem\><<<
-\typeout{***************** hello mhchem}
 \Configure{mhchemcf}{\HCode{<span class="mhchem">}}{\HCode{</span>}}
 \Configure{mhchemce}{\HCode{<span class="mhchem">}}{\HCode{</span>}}
 
@@ -21764,6 +21763,7 @@
 \Configure{mhchemisotope}{\HCode{<span class="mhchem-isotope">}}{\HCode{<br />&\#xfeff;}}{\HCode{</span>}}
 \Configure{mhchemsub}{\HCode {<sub class="mhchem-sub">}}{\HCode{</sub>} }
 \Configure{mhchemsup}{\HCode {<sup class="mhchem-sup">}}{\HCode{</sup>} }
+\Configure{mhchemsupsub}{\HCode{<span class="mhchem-supsub">}}{\HCode{<br />&\#xfeff;}}{\HCode{</span>}}
 % mhchemoperator is always used inside \HCode, so we need not to use \HCode in it's configuration
 \Configure{mhchemoperator}{<span class="mhchem-operator">}{</span>} 
 \Configure{mhchemarrow}{\HCode {<span class="mhchem-arrow">}}{\HCode{</span>}}

Modified: trunk/lit/tex4ht-mathml.tex
===================================================================
--- trunk/lit/tex4ht-mathml.tex	2024-02-19 13:33:57 UTC (rev 1463)
+++ trunk/lit/tex4ht-mathml.tex	2024-02-21 09:46:01 UTC (rev 1464)
@@ -5518,23 +5518,26 @@
 \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}>}
 



More information about the tex4ht-commits mailing list.