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

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Mon Nov 28 16:21:55 CET 2022


Author: michal_h21
Date: 2022-11-28 15:21:55 +0000 (Mon, 28 Nov 2022)
New Revision: 1255

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-mathjax.tex
Log:
provided the \RestoreMathJaxEnvironments command

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2022-11-28 12:01:50 UTC (rev 1254)
+++ trunk/lit/ChangeLog	2022-11-28 15:21:55 UTC (rev 1255)
@@ -1,5 +1,9 @@
 2022-11-28  Michal Hoftich  <michal.h21 at gmail.com>
 
+	* tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): provided the
+	\RestoreMathJaxEnvironments command.
+	https://tex.stackexchange.com/a/666771/2891
+
 	* tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): removed the
 	\fixmathjaxsec command, robust commands should be used instead.
 	https://tex.stackexchange.com/q/666705/2891

Modified: trunk/lit/tex4ht-mathjax.tex
===================================================================
--- trunk/lit/tex4ht-mathjax.tex	2022-11-28 12:01:50 UTC (rev 1254)
+++ trunk/lit/tex4ht-mathjax.tex	2022-11-28 15:21:55 UTC (rev 1255)
@@ -114,6 +114,32 @@
 }
 >>>
 
+In pictures, we want to use the original version of the math environments. Because we use
+an agressive verbatim method for the environments, we cannot use the usual \verb'\HLet' method.
+Instead, we save the original meaning, and user needs to restore it manually, using
+the \verb'\RestoreMathJaxEnvironments' command.
+
+\<defined commands\><<<
+\ExplSyntaxOn
+\seq_new:N\:savedmathjaxenvs
+
+\newcommand\:savemathjaxenv[1]{%
+  \seq_gput_right:Nn\:savedmathjaxenvs{#1}
+  \expandafter\let\csname mathjax-#1\expandafter\endcsname\csname #1\endcsname%
+  \expandafter\let\csname mathjax-end#1\expandafter\endcsname\csname end#1\endcsname%
+}
+
+\newcommand\RestoreMathJaxEnvironment[1]{%
+  \expandafter\let\csname #1\expandafter\endcsname\csname mathjax-#1\endcsname%
+  \expandafter\let\csname end#1\expandafter\endcsname\csname mathjax-end#1\endcsname%
+}
+
+\newcommand\RestoreMathJaxEnvironments{%
+  \seq_map_function:NN\:savedmathjaxenvs\RestoreMathJaxEnvironment%
+}
+\ExplSyntaxOff
+>>>
+
 The \verb|\VerbMath| command redefines environments to pass their content
 verbatim to the HTML output.
 
@@ -129,6 +155,7 @@
 \cs_generate_variant:Nn \regex_extract_once:nnNTF {nV}
 \newcommand\VerbMath[2][]{%
   \cs_if_exist:cTF{#2}{
+    \:savemathjaxenv{#2}%
     \RenewDocumentEnvironment{#2}{+!b}{%
       \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#2}\EndNoFonts%
       \ifx\relax#1\relax\else%



More information about the tex4ht-commits mailing list.