diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-06 22:47:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-06 22:47:02 +0000 |
commit | bd64664d83c0e06779df03522b502e612a6fb568 (patch) | |
tree | 07e1c41f967e6ceb62a5db2c4d730d73fdd9a375 /Master | |
parent | c3a379a51ff6149d725bb6d4687b4646b38628c3 (diff) |
\label inside mathjax equations, tex4ht r1210; mhchem support, tex4ht r1211-1212
git-svn-id: svn://tug.org/texlive/trunk@64643 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
5 files changed, 63 insertions, 16 deletions
diff --git a/Master/texmf-dist/source/generic/tex4ht/ChangeLog b/Master/texmf-dist/source/generic/tex4ht/ChangeLog index ea11301decc..dd2ab0b0c6d 100644 --- a/Master/texmf-dist/source/generic/tex4ht/ChangeLog +++ b/Master/texmf-dist/source/generic/tex4ht/ChangeLog @@ -1,3 +1,12 @@ +2022-10-06 Michal Hoftich <michal.h21@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@gmail.com> * tex4ht-mathml.tex (mathml.4ht): use displaystyle attribute also in diff --git a/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex b/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex index b6a23db4718..147cccbe243 100644 --- a/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex +++ b/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex @@ -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} diff --git a/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex b/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex index 0600eb10c38..2f511185f07 100644 --- a/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex +++ b/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex @@ -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 @@ environments. They will then keep the LaTeX code unchanged. 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 @@ Require verbatim math environments. \VerbMath{split} \VerbMath{multline} \VerbMath{multline*} -\VerbMath{equation} +\VerbMath[equation]{equation} \VerbMath{equation*} \VerbMath{math} \VerbMath{displaymath} @@ -204,3 +216,9 @@ Fixes for tables of contents. \fixmathjaxtoc\\ \fixmathjaxtoc\exp >>> + +\<configure mathjax-latex-4ht mhchem\><<< +\def\ce#1{\texttt{\detokenize{\(\ce{#1}\)}}} +>>> + +\endinput diff --git a/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht b/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht index 946035dd901..d50a7782d9d 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht @@ -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 diff --git a/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht b/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht index 6a6b9c1ed68..aaaceb9cfcb 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/usepackage.4ht @@ -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?} |