diff options
author | Karl Berry <karl@freefriends.org> | 2021-11-20 17:58:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-11-20 17:58:46 +0000 |
commit | 4ede05846cf39da0bbfd0484928394f414addc6a (patch) | |
tree | 0ba208658829b92c8622a7b528ec24ce7ae9de19 /Master | |
parent | efef4b038d6de2b8bc263303cf85c500e74d70a1 (diff) |
latex3 cmds for \VerbMath, tex4ht r1012
git-svn-id: svn://tug.org/texlive/trunk@61097 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
3 files changed, 35 insertions, 15 deletions
diff --git a/Master/texmf-dist/source/generic/tex4ht/ChangeLog b/Master/texmf-dist/source/generic/tex4ht/ChangeLog index 6a53f48d2fc..1a0fda78849 100644 --- a/Master/texmf-dist/source/generic/tex4ht/ChangeLog +++ b/Master/texmf-dist/source/generic/tex4ht/ChangeLog @@ -1,3 +1,8 @@ +2021-11-19 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): use LaTeX 3 commands in + \VerbMath, this enables us to remove dependency on external packages. + 2021-11-09 Michal Hoftich <michal.h21@gmail.com> * tex4ht-html4.tex (html4.4ht): added CSS declaration that enables table row diff --git a/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex b/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex index 9bad3b45f82..cb7559b255a 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 979 2021-09-14 17:59:36Z michal_h21 $ +% $Id: tex4ht-mathjax.tex 1012 2021-11-19 09:35:54Z michal_h21 $ % compile: latex tex4ht-mathjax % % Copyright 2018-2021 TeX Users Group @@ -29,8 +29,10 @@ \endinput >>> +We don't require additional packages anymore, as everything necessary is included +in LaTeX kernel now. +% \RequirePackage{etoolbox,expl3,environ} \<required packages\><<< -\RequirePackage{etoolbox,expl3,environ} >>> The \verb|\alteqtoks| command saves the used command in HTML. It uses detokenize command @@ -60,6 +62,8 @@ We still use regula expressions to escape invalid XML characters to entities, so \regex_replace_all:nnN { \x{26} } { & } \l_tmpa_tl \regex_replace_all:nnN { \x{3C} } { < } \l_tmpa_tl \regex_replace_all:nnN { \x{3E} } { > } \l_tmpa_tl + % replace \par command with blank lines + \regex_replace_all:nnN { \x{5C}par } {\x{A}\x{A}} \l_tmpa_tl \tl_set:Nx \l_tmpb_tl{ \l_tmpa_tl } \HCode{\l_tmpb_tl} } @@ -90,13 +94,21 @@ environments. They will then keep the LaTeX code unchanged. #1 \end{#2}}% } +>>> + +The \verb|\VerbMath| command redefines environments to pass their content +verbatim to the HTML output. + +\<defined commands\><<< +\ExplSyntaxOn \newcommand\VerbMath[1]{% -\ifcsdef{#1}{% - \RenewEnviron{#1}{% - \NoFonts\expandafter\VerbMathToks\expandafter{\BODY}{#1}\EndNoFonts% - } -}{}% + \cs_if_exist:cTF{#1}{ + \RenewDocumentEnvironment{#1}{+!b}{% + \NoFonts\expandafter\VerbMathToks\expandafter{##1}{#1}\EndNoFonts% + }{} + }{}% } +\ExplSyntaxOff >>> The \verb|\fixmathjaxtoc| command is used for patching commands which should 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 260a6be78e8..64a2b2956ea 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.sty (2021-09-14-14:13), generated from tex4ht-mathjax.tex +% mathjax-latex-4ht.sty (2021-11-20-09:56), generated from tex4ht-mathjax.tex % Copyright 2018-2021 TeX Users Group % % This work may be distributed and/or modified under the @@ -16,9 +16,8 @@ % % If you modify this program, changing the % version identification would be appreciated. -\immediate\write-1{version 2021-09-14-14:13} +\immediate\write-1{version 2021-11-20-09:56} -\RequirePackage{etoolbox,expl3,environ} \ExplSyntaxOn \cs_new_protected:Npn \alteqtoks #1 @@ -28,6 +27,8 @@ \regex_replace_all:nnN { \x{26} } { & } \l_tmpa_tl \regex_replace_all:nnN { \x{3C} } { < } \l_tmpa_tl \regex_replace_all:nnN { \x{3E} } { > } \l_tmpa_tl + % replace \par command with blank lines + \regex_replace_all:nnN { \x{5C}par } {\x{A}\x{A}} \l_tmpa_tl \tl_set:Nx \l_tmpb_tl{ \l_tmpa_tl } \HCode{\l_tmpb_tl} } @@ -47,13 +48,15 @@ #1 \end{#2}}% } +\ExplSyntaxOn \newcommand\VerbMath[1]{% -\ifcsdef{#1}{% - \RenewEnviron{#1}{% - \NoFonts\expandafter\VerbMathToks\expandafter{\BODY}{#1}\EndNoFonts% - } -}{}% + \cs_if_exist:cTF{#1}{ + \RenewDocumentEnvironment{#1}{+!b}{% + \NoFonts\expandafter\VerbMathToks\expandafter{##1}{#1}\EndNoFonts% + }{} + }{}% } +\ExplSyntaxOff \def\fixmathjaxtoc#1{\Configure{writetoc}{\def#1{\detokenize{#1}}}} \def\fixmathjaxsec#1{\def#1{\detokenize{#1}}} |