summaryrefslogtreecommitdiff
path: root/support/TeX4ht
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-03-02 03:04:21 +0000
committerNorbert Preining <norbert@preining.info>2024-03-02 03:04:21 +0000
commitb7323fe884f378851ee661babaa5bd644271f348 (patch)
tree8891732393826e5c5893d00fa39cf9a5eb0a3a90 /support/TeX4ht
parent19a826b6e3a0d2ea6bbd1bf733a8e590463275ed (diff)
CTAN sync 202403020304
Diffstat (limited to 'support/TeX4ht')
-rw-r--r--support/TeX4ht/source/ChangeLog22
-rw-r--r--support/TeX4ht/source/tex4ht-4ht.tex7
-rw-r--r--support/TeX4ht/source/tex4ht-html4.tex6
-rw-r--r--support/TeX4ht/source/tex4ht-mathml.tex98
4 files changed, 117 insertions, 16 deletions
diff --git a/support/TeX4ht/source/ChangeLog b/support/TeX4ht/source/ChangeLog
index 25932eb8b7..086599fff3 100644
--- a/support/TeX4ht/source/ChangeLog
+++ b/support/TeX4ht/source/ChangeLog
@@ -1,3 +1,25 @@
+2024-02-29 Michal Hoftich <michal.h21@gmail.com>
+
+ * tex4ht-html4.tex (html4.4ht): use \HCode to print <div> for
+ the appendices environment.
+
+ * tex4ht-4ht.tex (hyperref.4ht): declared the \Hy@appendixstring
+ command from Hyperref.
+
+ * tex4ht-mathml.tex (mathml.4ht): enclose Mhchem commands in a
+ group, to suppport subscripts and superscripts.
+
+ * tex4ht-mathml.tex (mathml.4ht): fixed Mhchem arrows in MathML.
+
+2024-02-27 Michal Hoftich <michal.h21@gmail.com>
+
+ * tex4ht-html4.tex (html4.4ht),
+ * tex4ht-mathml.tex (mathml.4ht): fixed some issues in arrow
+ formatting.
+
+ * tex4ht-4ht.tex (mhchem.4ht): fixed formatting of left and
+ right bond arrows.
+
2024-02-26 Michal Hoftich <michal.h21@gmail.com>
* tex4ht-4ht.tex (latex.4ht): make \footnotemark and \footnotetext
diff --git a/support/TeX4ht/source/tex4ht-4ht.tex b/support/TeX4ht/source/tex4ht-4ht.tex
index b17a83bd60..dada4784b3 100644
--- a/support/TeX4ht/source/tex4ht-4ht.tex
+++ b/support/TeX4ht/source/tex4ht-4ht.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1475 2024-02-26 13:19:17Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1480 2024-02-29 16:20:20Z michal_h21 $
% tex tex4ht-4ht or ht tex tex4ht-4ht
%
% Copyright 2009-2024 TeX Users Group
@@ -6031,6 +6031,7 @@ They are used by some packages, for example Lastpage, so we need to declare them
\<config hyperref\><<<
\def\Hy@PageAnchorSlidesPlain{}%
\def\Hy@PageAnchorSlide{}%
+\def\Hy@appendixstring{appendix}
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -30957,8 +30958,8 @@ it come out as a complete mess.
\:tempa \__mhchem_output_bond_dotdotdot: { \HCode { &\#xB7;&\#xB7;&\#xB7;} } % &middot;&middot;&middot;
\:tempa \__mhchem_output_bond_dotdotdotdot: { \HCode { &\#xB7;&\#xB7;&\#xB7;&\#xB7;} } % &middot;&middot;&middot;&middot;
-\:tempa \__mhchem_output_bond_rightArrow: { \HCode { &\#xffeb; } }
-\:tempa \__mhchem_output_bond_leftArrow: { \HCode { &\#xffe9; } }
+\:tempa \__mhchem_output_bond_rightArrow: { \HCode {\a:mhchemoperator &\#x2192;\b:mhchemoperator } }
+\:tempa \__mhchem_output_bond_leftArrow: {\HCode {\a:mhchemoperator &\#x2190;\b:mhchemoperator }}
\NewConfigure{mhchembondhalf}{1}
diff --git a/support/TeX4ht/source/tex4ht-html4.tex b/support/TeX4ht/source/tex4ht-html4.tex
index 8077218bec..9ea67de9bc 100644
--- a/support/TeX4ht/source/tex4ht-html4.tex
+++ b/support/TeX4ht/source/tex4ht-html4.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-html4.tex 1464 2024-02-21 09:46:01Z michal_h21 $
+% $Id: tex4ht-html4.tex 1481 2024-02-29 16:25:52Z michal_h21 $
% Compile 4 times: latex tex4ht-html4
% Copy html4.4ht into the work directory before all but the last compilation.
%
@@ -21769,7 +21769,7 @@ users redefine the latter macro.
\Configure{mhchemarrow}{\HCode {<span class="mhchem-arrow">}}{\HCode{</span>}}
\Configure{mhchemarrowabove}{\HCode {<span class="mhchem-above">}}{\HCode{</span>}}
\Configure{mhchemarrowyields}{\HCode{<span class="mhchem-arrow-normal">&\#x27F6;</span>}}
-\Configure{mhchemarrowyieldsLeft}{\HCode{<span class="mhchem-arrow-normal">&\#x2190;</span>}}
+\Configure{mhchemarrowyieldsLeft}{\HCode{<span class="mhchem-arrow-normal">&\#x27F5;</span>}}
\Configure{mhchemarrowyieldsLeftRight}{\HCode{<span class="mhchem-arrow-normal">&\#x21c4;</span>}} % todo: improve
\Configure{mhchemarrowmesomerism}{\HCode{<span class="mhchem-arrow-normal">&\#x2194;</span>}} % todo: improve
\Configure{mhchemarrowequilibrium}{\HCode{<span class="mhchem-arrow-normal">&\#x21cc;</span>}} % todo: improve
@@ -22789,7 +22789,7 @@ them in the same row.
%%%%%%%%%%%%%%%%%
\section{appendix}
\<configure html4 appendix\><<<
-\ConfigureEnv{appendices}{\ifvmode\IgnorePar\fi\EndP{<div class="appendices">}}{\ifvmode\IgnorePar\fi\EndP{</div>}}{}{}
+\ConfigureEnv{appendices}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="appendices">}}{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}{}{}
>>>
diff --git a/support/TeX4ht/source/tex4ht-mathml.tex b/support/TeX4ht/source/tex4ht-mathml.tex
index 68ed7dfddc..334af00519 100644
--- a/support/TeX4ht/source/tex4ht-mathml.tex
+++ b/support/TeX4ht/source/tex4ht-mathml.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-mathml.tex 1464 2024-02-21 09:46:01Z michal_h21 $$
+% $Id: tex4ht-mathml.tex 1479 2024-02-29 16:07:34Z michal_h21 $$
% compile 3 times: latex tex4ht-mathltx
% or xhlatex tex4ht-mathltx "html,3,sections+"
%
@@ -5515,8 +5515,8 @@ with small shifting.
\<configure mathml mhchem\><<<
-\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}>}}
+\Configure{mhchemcf}{\bgroup\HCode{<\:mhmathmlorhtml{mrow}{span}\space class="mhchem-cf">}}{\HCode{</\:mhmathmlorhtml{mrow}{span}>}\egroup}
+\Configure{mhchemce}{\bgroup\HCode{<\:mhmathmlorhtml{mrow}{span}\space class="mhchem-ce">}}{\HCode{</\:mhmathmlorhtml{mrow}{span}>}\egroup}
% 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-}
@@ -5538,25 +5538,31 @@ with small shifting.
\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}>}
+\Configure{mhchemoperator}{<\:mhmathmlorhtml{mo \a:mathml stretchy="false" }{span} class="mhchem-operator">}{</\:mhmathmlorhtml{mo}{span}>}
\Configure{mhchemarrow}{\HCode {<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow">\:mhonlyinmathml{\a:mhchemoperator}}\PauseMathClass}{\EndPauseMathClass\HCode{\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}
\Configure{mhchemarrowabove}{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-above">\:mhonlyinmathml{\a:mhchemoperator}}\PauseMathClass}{\EndPauseMathClass\HCode{\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}
-\Configure{mhchemarrowyields}{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x2192;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}
-\Configure{mhchemarrowyieldsLeft}{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x2190;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>} }
-\Configure{mhchemarrowyieldsLeftRight}{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x21c4;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}} % todo: improve
+\Configure{mhchemarrowyields}{\ensuremath{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x27F6;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}}
+\Configure{mhchemarrowyieldsLeft}{\ensuremath{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x27F5;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}}
+\Configure{mhchemarrowyieldsLeftRight}{\ensuremath{\HCode{<\a:mathml munder class="mhchem-arrow-larger"><\a:mathml mrow><\a:mathml mpadded height="0" depth="0.3em"><\a:mathml mo stretchy="false" >&\#x27F5;</\a:mathml mo></\a:mathml mpadded></\a:mathml mrow>
+ <\a:mathml mrow><\a:mathml mpadded depth="0" height="0"><\a:mathml mo stretchy="false">&\#x27F6;</\a:mathml mo></\a:mathml mpadded></\a:mathml mrow></\a:mathml munder>}
+}}
\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
+% \Configure{mhchemarrowequilibrium}{\ensuremath{\HCode{<\:mhmathmlorhtml{mrow}{span} class="mhchem-arrow-normal">\:mhonlyinmathml{\a:mhchemoperator}&\#x21cc;\:mhonlyinmathml{\b:mhchemoperator}</\:mhmathmlorhtml{mrow}{span}>}}} % todo: improve
+\Configure{mhchemarrowequilibrium}{\ensuremath{\HCode{<\a:mathml munder class="mhchem-arrow-larger"><\a:mathml mrow><\a:mathml mpadded height="0" depth="0" voffset="-0.1em" ><\a:mathml mo stretchy="true" >&\#x21c0;</\a:mathml mo></\a:mathml mpadded></\a:mathml mrow>
+ <\a:mathml mpadded height="0" depth="0" ><\a:mathml mo stretchy="false">&\#x21bd;</\a:mathml mo></\a:mathml mpadded></\a:mathml munder>}
+}} % todo: improve
% 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}
{\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>}
+ <\a:mathml mpadded height="0" depth="1" voffset="2px"><\a:mathml mspace width="0.167em"></\a:mathml mspace><\a:mathml mo stretchy="false">&\#x21bd;</\a:mathml mo><\a:mathml mspace width="0.167em"></\a:mathml mspace></\a:mathml mpadded></\a:mathml munder>}
}} % todo: improve
\Configure{mhchemarrowequilibriumLeft}
-{\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>
+{\ensuremath{\HCode{<\a:mathml munder class="mhchem-arrow-larger"><\a:mathml mrow><\a:mathml mpadded height="0" depth="1" voffset="4px"><\a:mathml mspace width="0.167em"></\a:mathml mspace><\a:mathml mo stretchy="false">&\#x21c0;</\a:mathml mo><\a:mathml mspace width="0.167em"></\a:mathml 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
@@ -5567,6 +5573,78 @@ with small shifting.
\Configure{mhchembondoneandhalf}{\HCode{<span class="mhchem-rlap">&\#x2212;</span><span class="mhchem-bond-half-top">&\#xfe4d;</span>}}
\Configure{mhchembondtwoandhalf}{\HCode{<span class="mhchem-rlap">=</span><span class="mhchem-bond-half-top">&\#xfe4d;</span>}}
\Configure{mhchembondtwoandhalff}{\HCode{<span class="mhchem-rlap mhchem-bond-top">&\#x2212;</span><span class="mhchem-rlap mhchem-bond-bottom">&\#x2212;</span><span class="mhchem-bond-half-middle">&\#xfe4d;</span>}}
+
+|<mhchemarrows|>
+>>>
+
+This is a local redefinition of the text over and under arrow handling code for MathML. We need to do change the sequence of
+elements that are printed to support the munderover element easily.
+
+\<mhchemarrows\><<<
+\ExplSyntaxOn
+\cs_set_protected:Npn \__mhchem_arrow_deployfourht:nnnnn #1#2#3#4#5
+ {
+\bgroup
+\ensuremath{%
+ % we need to test if the text is larger than arrow. if it is, the math operator needs to be stretchy.
+ % otherwise, it must be not stretchy, otherwise the text over arrow will be aligned to the right
+ \setbox0=\hbox{\tl_if_empty:nF {#3#5}
+ {
+ \str_case:nnF {#2}
+ {
+ { } { \ce{ #5 } }
+ { M } { { #5 } }
+ { T } { \text{ #5 } }
+ { C } { \ce{ #5 } }
+ }
+ { \msg_error:nnn { mhchem } { unexpected-arrow-type } {#2} }
+ }}
+ \setbox1=\hbox{\tl_if_empty:nF {#3#5}
+ {
+ \str_case:nnF {#2}
+ {
+ { } { \ce{ #3 } }
+ { M } { { #3 } }
+ { T } { \text{ #3 } }
+ { C } { \ce{ #3 } }
+ }
+ { \msg_error:nnn { mhchem } { unexpected-arrow-type } {#2} }
+ }}
+ % now compare dimensions of boxes and change math stretchines
+ \ifdim \wd0>1em
+ \Configure{mhchemoperator}{<\a:mathml mo~\a:mathml stretchy="true"~\a:mathml class="mhchem-operator">}{</\a:mathml mo>}
+ \else
+ \ifdim \wd1>1em
+ \Configure{mhchemoperator}{<\a:mathml mo~\a:mathml stretchy="true"~\a:mathml class="mhchem-operator">}{</\a:mathml mo>}
+ \fi
+ \fi
+\a:mhchemmathlarrow
+ \str_case:nnF {#1}
+ {
+ { yields } {\a:mhchemarrowyields }
+ { yieldsLeft } {\a:mhchemarrowyieldsLeft }
+ { yieldsLeftRight } {\a:mhchemarrowyieldsLeftRight } % todo: improve
+ { esomerism } {\a:mhchemarrowesomerism } % todo: improve
+ { equilibrium } {\a:mhchemarrowequilibrium } % todo: improve
+ { equilibriumRight } {\a:mhchemarrowequilibriumRight } % todo: improve
+ { equilibriumLeft } {\a:mhchemarrowequilibriumLeft } % todo: improve
+ }
+ { \msg_error:nnn { mhchem } { unexpected-arrow-type } {#1} }
+\b:mhchemmathlarrow
+ \box0
+\c:mhchemmathlarrow
+ \box1
+\d:mhchemmathlarrow
+}
+\egroup
+ }
+
+\HRestore\__mhchem_arrow_deploy:nnnnn
+\HLet\__mhchem_arrow_deploy:nnnnn\__mhchem_arrow_deployfourht:nnnnn
+\ExplSyntaxOff
+
+\NewConfigure{mhchemmathlarrow}{4}
+\Configure{mhchemmathlarrow}{\HCode{<\a:mathml munderover><\a:mathml mrow>}}{\HCode{</\a:mathml mrow><\a:mathml mpadded>}}{\HCode{</\a:mathml mpadded><\a:mathml mpadded>}}{\HCode{</\a:mathml mpadded></\a:mathml munderover>}}
>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%