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

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Fri Sep 27 13:07:49 CEST 2024


Author: michal_h21
Date: 2024-09-27 11:07:49 +0000 (Fri, 27 Sep 2024)
New Revision: 1562

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-html4.tex
   trunk/lit/tex4ht-mathjax.tex
Log:
enclose math elements in mathjax in html tags

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2024-09-27 10:31:47 UTC (rev 1561)
+++ trunk/lit/ChangeLog	2024-09-27 11:07:49 UTC (rev 1562)
@@ -1,5 +1,10 @@
 2024-09-27  Michal Hoftich  <michal.h21 at gmail.com>
 
+	* tex4ht-html4.tex (html4-math.4ht),
+	* tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): enclose math elements
+	in MathJax in HTML tags.
+	https://tex.stackexchange.com/a/727413/2891
+
 	* tex4ht-html4.tex (html4-math.4ht): don't add link to the MathJax
 	script if the address is empty.
 

Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex	2024-09-27 10:31:47 UTC (rev 1561)
+++ trunk/lit/tex4ht-html4.tex	2024-09-27 11:07:49 UTC (rev 1562)
@@ -8790,16 +8790,22 @@
 };
 }
 \fi
+\NewConfigure{MathjaxInline}{2}
+\NewConfigure{MathjaxBlock}{2}
+\Configure{MathjaxInline}{\HCode{<span class="mathjax-inline">}}{\HCode{</span>}}
+\Configure{MathjaxBlock}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="mathjax-block">}}{\HCode{</div>}}
+\Configure{MathjaxEnv}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="mathjax-env mathjax-\@currenvir">}}{\HCode{</div>}}
+
 \Configure{@HEAD}{\HCode{<script>window.MathJax = \a:MathJaxConfig</script>\Hnewline}}
 \Configure{MathjaxSource}{https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js}
 \Configure{@HEAD}{\ifx\a:MathjaxSource\@empty\else\HCode{<script type="text/javascript" async="async" id="MathJax-script" src="\a:MathjaxSource"></script> \Hnewline}\fi}
 \edef\:RestoreMathjaxCatcodes{\catcode`\noexpand \&=\the\catcode`\&}
 \def\:HandleMathjaxCatcodes{\edef\:RestoreMathjaxCatcodes{\catcode`\noexpand \&=\the\catcode`\&}\catcode`\&=11}
-\Configure{$}{\:HandleMathjaxCatcodes}{\:RestoreMathjaxCatcodes}{\expandafter\AltMathOne}
-\Configure{$$}{\:HandleMathjaxCatcodes}{\:RestoreMathjaxCatcodes}{\expandafter\AltlDisplayDollars}
-% for some reason, it is necessary to specify the catcode change directly in the configuration
-\Configure{()}{\:HandleMathjaxCatcodes\catcode`\&=11\AltlMath}{\:RestoreMathjaxCatcodes}
-\Configure{[]}{\:HandleMathjaxCatcodes\catcode`\&=11\AltlDisplay}{\:RestoreMathjaxCatcodes}
+\Configure{$}{\a:MathjaxInline\:HandleMathjaxCatcodes}{\:RestoreMathjaxCatcodes\b:MathjaxInline}{\expandafter\AltMathOne}
+\Configure{()}{\a:MathjaxInline\:HandleMathjaxCatcodes\catcode`\&=11\AltlMath}{\:RestoreMathjaxCatcodes\b:MathjaxInline}
+\Configure{$$}{\a:MathjaxBlock\:HandleMathjaxCatcodes}{\:RestoreMathjaxCatcodes\b:MathjaxBlock}{\expandafter\AltlDisplayDollars}
+\Configure{[]}{\a:MathjaxBlock\:HandleMathjaxCatcodes\catcode`\&=11\AltlDisplay}{\:RestoreMathjaxCatcodes\b:MathjaxBlock}
+
 \fi
 >>>
 

Modified: trunk/lit/tex4ht-mathjax.tex
===================================================================
--- trunk/lit/tex4ht-mathjax.tex	2024-09-27 10:31:47 UTC (rev 1561)
+++ trunk/lit/tex4ht-mathjax.tex	2024-09-27 11:07:49 UTC (rev 1562)
@@ -131,10 +131,14 @@
 % beginning of each display math
 \long\def\AltlDisplayDollars#1$${\alteqtoks{\[#1\]}$$}
 
+\NewConfigure{MathjaxEnv}{2}
+
 \newcommand\VerbMathToks[2]{%
+  \a:MathjaxEnv%
   \HCode{\string\begin{#2}}%
     \alteqtoks{#1}%
   \HCode{\string\end{#2}}%
+  \b:MathjaxEnv%
 }
 >>>
 



More information about the tex4ht-commits mailing list.