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

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Mon Feb 19 14:33:57 CET 2024


Author: michal_h21
Date: 2024-02-19 13:33:57 +0000 (Mon, 19 Feb 2024)
New Revision: 1463

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-mathml.tex
Log:
fixed rendering of some Mhchem arrorws

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2024-02-15 10:47:46 UTC (rev 1462)
+++ trunk/lit/ChangeLog	2024-02-19 13:33:57 UTC (rev 1463)
@@ -1,3 +1,8 @@
+2024-02-19  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-mathml.tex (mathml.4ht): fixed rendering of
+	mhchemarrowequilibriumLeft and mhchemarrowequilibriumRight.
+
 2024-02-15  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-fonts-noncjk.tex (

Modified: trunk/lit/tex4ht-mathml.tex
===================================================================
--- trunk/lit/tex4ht-mathml.tex	2024-02-15 10:47:46 UTC (rev 1462)
+++ trunk/lit/tex4ht-mathml.tex	2024-02-19 13:33:57 UTC (rev 1463)
@@ -5545,16 +5545,18 @@
 \Configure{mhchemarrowyieldsLeftRight}{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x21c4;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}  % todo: improve
 \Configure{mhchemarrowmesomerism}{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x2194;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}  % todo: improve
 \Configure{mhchemarrowequilibrium}{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x21cc;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}  % todo: improve
-% this configuration leads to two arrows next to each other. but I cannot a
-% better configuration right now. this symbol doesn't have Unicode support
+% this configuration is inspired by the MathML code from MathJax. There is a problem with vertical positioning of arrows, so we need to use 
+% the <mpadded> element to fix that. It is still not perfect, moreover, there is a difference in rendering between 
+% vanilla Firefox and MathJax's MathML
 \Configure{mhchemarrowequilibriumRight}
-{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-larger">\:mhonlyinmathml{\a:mhchemoperator}&\#x21c0;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>
-<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-complement">\:mhonlyinmathml{\a:mhchemoperator}&\#x21bd;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}
-}  % todo: improve
+{\ensuremath{\HCode{<\a:mathml munder class="mhchem-arrow-larger"><\a:mathml mrow><\a:mathml mpadded  height="0" depth="1" voffset="3px"><\a:mathml mo  stretchy="true" >&\#x21c0;</\a:mathml mo></\a:mathml mpadded></\a:mathml mrow>
+  <\a:mathml mpadded height="0" depth="1" voffset="2px"><mspace width="0.167em"></mspace><\a:mathml mo stretchy="false">&\#x21bd;</\a:mathml mo><mspace width="0.167em"></mspace></\a:mathml mpadded></\a:mathml munder>}
+}}  % todo: improve
 \Configure{mhchemarrowequilibriumLeft}
-{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-complement">\:mhonlyinmathml{\a:mhchemoperator}&\#x21c0;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>
-<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-larger">\:mhonlyinmathml{\a:mhchemoperator}&\#x21bd;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}
-}  % todo: improve
+{\ensuremath{\HCode{<\a:mathml munder class="mhchem-arrow-larger"><\a:mathml mrow><\a:mathml mpadded  height="0" depth="1" voffset="4px"><mspace width="0.167em"></mspace><\a:mathml mo stretchy="false">&\#x21c0;</\a:mathml mo><mspace width="0.167em"></mspace></\a:mathml mpadded></\a:mathml mrow>
+  <\a:mathml mpadded  height="0" depth="1" voffset="2px"><\a:mathml mo  stretchy="true" >&\#x21bd;</\a:mathml mo></\a:mathml mpadded></\a:mathml munder>}
+}}  % todo: improve
+
 % this is not the right symbol
 % \Configure{mhchemarrowequilibriumRight}{\a:mhchemoperator\HCode{&\#x2942;}\b:mhchemoperator }  % todo: improve
 % \Configure{mhchemarrowequilibriumLeft}{\a:mhchemoperator\HCode{&\#x2943;}\b:mhchemoperator}  % todo: improve



More information about the tex4ht-commits mailing list.