texlive[64643] Master/texmf-dist: \label inside mathjax equations,

commits+karl at tug.org commits+karl at tug.org
Fri Oct 7 00:47:02 CEST 2022


Revision: 64643
          http://tug.org/svn/texlive?view=revision&revision=64643
Author:   karl
Date:     2022-10-07 00:47:02 +0200 (Fri, 07 Oct 2022)
Log Message:
-----------
\label inside mathjax equations, tex4ht r1210; mhchem support, tex4ht r1211-1212

Revision Links:
--------------
    http://tug.org/svn/texlive?view=revision&revision=1210
    http://tug.org/svn/texlive?view=revision&revision=1211

Modified Paths:
--------------
    trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
    trunk/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex
    trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex
    trunk/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht
    trunk/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog	2022-10-06 20:49:43 UTC (rev 64642)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog	2022-10-06 22:47:02 UTC (rev 64643)
@@ -1,3 +1,12 @@
+2022-10-06  Michal Hoftich  <michal.h21 at gmail.com>
+	
+	* tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): added basic support
+	for Mhchem.
+
+	* tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): added basic support
+	for \label commands inside equations.
+	https://tex.stackexchange.com/a/660581/2891
+
 2022-10-05  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-mathml.tex (mathml.4ht): use displaystyle attribute also in

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex	2022-10-06 20:49:43 UTC (rev 64642)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex	2022-10-06 22:47:02 UTC (rev 64643)
@@ -1,4 +1,4 @@
-% $Id: mktex4ht-cnf.tex 1196 2022-09-20 15:05:23Z michal_h21 $
+% $Id: mktex4ht-cnf.tex 1212 2022-10-06 10:29:28Z michal_h21 $
 % Manually-maintained file, listing *.4ht files created by tex4ht-4ht.tex.
 % Read by tex4ht-cond4ht.
 %
@@ -378,4 +378,5 @@
 \AddFile{9}{sectionbreak}
 \AddFile{9}{subfiles}
 \AddFile{9}{fontawesome5}
+\AddFile{9}{mhchem}
 % \AddFile{9}{mktex4ht}

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex	2022-10-06 20:49:43 UTC (rev 64642)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex	2022-10-06 22:47:02 UTC (rev 64643)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-mathjax.tex 1190 2022-08-29 10:21:19Z michal_h21 $
+% $Id: tex4ht-mathjax.tex 1212 2022-10-06 10:29:28Z michal_h21 $
 % compile: latex tex4ht-mathjax
 %
 % Copyright 2018-2022 TeX Users Group
@@ -99,12 +99,24 @@
 The \verb|\VerbMath| command redefines environments to pass their content
 verbatim to the HTML output.
 
+The optional command can contain name of the counter that should be updated.
+It will also use LaTeX 3 regular expressions to search for label commands.
+Thanks to that, cross-referencing to the math environments should work.
+It is a bit limited, for example subequations cannot work. There can be also
+issues in books, where equation numbers are based on chapters, but MathJax
+numbers them consecutively. In these cases, other mechanisms may be necessary.
+
 \<defined commands\><<<
 \ExplSyntaxOn
-\newcommand\VerbMath[1]{%
-  \cs_if_exist:cTF{#1}{
-    \RenewDocumentEnvironment{#1}{+!b}{%
-      \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#1}\EndNoFonts%
+\cs_generate_variant:Nn \regex_extract_once:nnNTF {nV}
+\newcommand\VerbMath[2][]{%
+  \cs_if_exist:cTF{#2}{
+    \RenewDocumentEnvironment{#2}{+!b}{%
+      \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#2}\EndNoFonts%
+      \ifx\relax#1\relax\else%
+      \refstepcounter{#1}%
+      \regex_extract_once:nVNTF { label\s* \x{7B}([^\x{7D}]*)\x{7D}} {\l_tmpb_tl} \l_tmp_seq {\label{\seq_item:Nn\l_tmp_seq{2}}} {}%
+      \fi
     }{}
   }{}%
 }
@@ -154,7 +166,7 @@
 \VerbMath{split}
 \VerbMath{multline}
 \VerbMath{multline*}
-\VerbMath{equation}
+\VerbMath[equation]{equation}
 \VerbMath{equation*}
 \VerbMath{math}
 \VerbMath{displaymath}
@@ -204,3 +216,9 @@
 \fixmathjaxtoc\\
 \fixmathjaxtoc\exp
 >>>
+
+\<configure mathjax-latex-4ht mhchem\><<<
+\def\ce#1{\texttt{\detokenize{\(\ce{#1}\)}}}
+>>>
+
+\endinput

Modified: trunk/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht	2022-10-06 20:49:43 UTC (rev 64642)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht	2022-10-06 22:47:02 UTC (rev 64643)
@@ -1,4 +1,4 @@
-% mathjax-latex-4ht.4ht (2022-08-29-13:30), generated from tex4ht-mathjax.tex
+% mathjax-latex-4ht.4ht (2022-10-06-13:16), generated from tex4ht-mathjax.tex
 % Copyright 2018-2022 TeX Users Group
 %
 % This work may be distributed and/or modified under the
@@ -16,7 +16,7 @@
 %
 % If you modify this program, changing the
 % version identification would be appreciated.
-\immediate\write-1{version 2022-08-29-13:30}
+\immediate\write-1{version 2022-10-06-13:16}
 
 
 \ExplSyntaxOn
@@ -49,10 +49,15 @@
   \end{#2}}%
 }
 \ExplSyntaxOn
-\newcommand\VerbMath[1]{%
-  \cs_if_exist:cTF{#1}{
-    \RenewDocumentEnvironment{#1}{+!b}{%
-      \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#1}\EndNoFonts%
+\cs_generate_variant:Nn \regex_extract_once:nnNTF {nV}
+\newcommand\VerbMath[2][]{%
+  \cs_if_exist:cTF{#2}{
+    \RenewDocumentEnvironment{#2}{+!b}{%
+      \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#2}\EndNoFonts%
+      \ifx\relax#1\relax\else%
+      \refstepcounter{#1}%
+      \regex_extract_once:nVNTF { label\s* \x{7B}([^\x{7D}]*)\x{7D}} {\l_tmpb_tl} \l_tmp_seq {\label{\seq_item:Nn\l_tmp_seq{2}}} {}%
+      \fi
     }{}
   }{}%
 }
@@ -88,7 +93,7 @@
 \VerbMath{split}
 \VerbMath{multline}
 \VerbMath{multline*}
-\VerbMath{equation}
+\VerbMath[equation]{equation}
 \VerbMath{equation*}
 \VerbMath{math}
 \VerbMath{displaymath}
@@ -127,6 +132,7 @@
 
 }
 \endinput
+\exit:ifnot{mhchem}
 
 
 
@@ -600,5 +606,18 @@
 
 
 
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+                \ConfigureHinput{mhchem}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+    \def\ce#1{\texttt{\detokenize{\(\ce{#1}\)}}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+  
+\endinput\empty\empty\empty\empty\empty\empty
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
 \endinput
 

Modified: trunk/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht	2022-10-06 20:49:43 UTC (rev 64642)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht	2022-10-06 22:47:02 UTC (rev 64643)
@@ -1,4 +1,4 @@
-% usepackage.4ht (2022-10-04-13:07), generated from tex4ht-4ht.tex
+% usepackage.4ht (2022-10-06-13:16), generated from tex4ht-4ht.tex
 % Copyright 2003-2009 Eitan M. Gurari
 % Copyright 2009-2022 TeX Users Group
 %
@@ -17,7 +17,7 @@
 %
 % If you modify this program, changing the
 % version identification would be appreciated.
-\immediate\write-1{version 2022-10-04-13:07}
+\immediate\write-1{version 2022-10-06-13:16}
 
    \def\:temp{tex4ht}\ifx \:temp\@currname
    \:warning{\string\usepackage{tex4ht} again?}



More information about the tex-live-commits mailing list.