texlive[72917] Master/texmf-dist: fastmathjax option, tex4ht r1598;

commits+karl at tug.org commits+karl at tug.org
Wed Nov 20 23:20:18 CET 2024


Revision: 72917
          https://tug.org/svn/texlive?view=revision&revision=72917
Author:   karl
Date:     2024-11-20 23:20:18 +0100 (Wed, 20 Nov 2024)
Log Message:
-----------
fastmathjax option, tex4ht r1598; qtree support, tex4ht r1599

Revision Links:
--------------
    https://tug.org/svn/texlive?view=revision&revision=1598
    https://tug.org/svn/texlive?view=revision&revision=1599

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-4ht.tex
    trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/generic/tex4ht/qtree.4ht

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog	2024-11-20 22:17:08 UTC (rev 72916)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog	2024-11-20 22:20:18 UTC (rev 72917)
@@ -1,3 +1,11 @@
+2024-11-20  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (qtree.4ht): added support for the Qtree package.
+
+	* tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): added the
+	"fastmathjax" option.
+	https://tug.org/pipermail/tex4ht/2024q4/003625.html
+
 2024-11-17  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-4ht.tex (manyfoot-hooks.4ht): fixed normal footnote numbers

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex	2024-11-20 22:17:08 UTC (rev 72916)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex	2024-11-20 22:20:18 UTC (rev 72917)
@@ -1,4 +1,4 @@
-% $Id: mktex4ht-cnf.tex 1594 2024-11-05 10:24:06Z michal_h21 $
+% $Id: mktex4ht-cnf.tex 1599 2024-11-20 20:38:22Z michal_h21 $
 % Manually-maintained file, listing *.4ht files created by tex4ht-4ht.tex.
 % Read by tex4ht-cond4ht.
 %
@@ -207,6 +207,7 @@
 \AddFile{9}{xy}
 \AddFile{9}{xyling}
 \AddFile{9}{xyling-hooks}
+\AddFile{9}{qtree}
 \AddFile{9}{pictex}
 \AddFile{9}{diagrams}
 \AddFile{9}{pstricks}

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex	2024-11-20 22:17:08 UTC (rev 72916)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex	2024-11-20 22:20:18 UTC (rev 72917)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1597 2024-11-17 22:03:56Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1599 2024-11-20 20:38:22Z michal_h21 $
 % tex tex4ht-4ht   or   ht tex tex4ht-4ht
 %
 % Copyright 2009-2024 TeX Users Group    
@@ -27945,6 +27945,32 @@
 \HLet\Treek\xyling:Treek
 >>>
 
+%%%%%%%%%%%%%%%%%%%%%%%%
+\Section{qtree}
+%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<qtree.4ht\><<< 
+% qtree.4ht (|version), generated from |jobname.tex
+% Copyright 2024 TeX Users Group
+|<TeX4ht license text|> 
+
+|<qtree images|>
+
+\Hinput{qtree} 
+\endinput
+>>> \AddFile{9}{qtree}
+
+We want to convert the whole contents of the \''\Tree' command to pictures.
+
+\<qtree images\><<<
+\NewConfigure{qtree}{2}
+
+\pend:def\Tree{\a:qtree}
+\append:def\endTree{\b:qtree}
+
+\Configure{qtree}{\Picture+[\csname a:Picture-alt\endcsname]{}}{\EndPicture}
+>>>
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \Section{PicTeX}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex	2024-11-20 22:17:08 UTC (rev 72916)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex	2024-11-20 22:20:18 UTC (rev 72917)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-mathjax.tex 1589 2024-10-25 14:47:14Z michal_h21 $
+% $Id: tex4ht-mathjax.tex 1598 2024-11-20 11:40:35Z michal_h21 $
 % compile: latex tex4ht-mathjax
 %
 % Copyright 2018-2024 TeX Users Group
@@ -40,7 +40,8 @@
 The \verb|\alteqtoks| command prints the used LaTeX math code to the output document in 
 verbatim. 
 
-In the past, we used \verb|\detokenize|. The side effect of this is that detokeize inserts space
+We use \verb|\detokenize| to output verbatim LaTeX code to the HTML document. 
+The side effect of this is that detokenize inserts space
 after each control sequence. This is completely valid TeX code, but earlier versions of
 MathJax didn't like that, rendering resulted in error.
 
@@ -77,9 +78,41 @@
 
 
 We still use regular expressions to escape invalid XML characters to entities, so it works only with LaTeX.
+But regular expressions may be slow if there is a huge number of math, and they may fail if contents 
+of any math environment is larger than 64 KB.  
 
+So we provide a "fastmathjax" option, that doesn't do any post-processing of the math contents. It should 
+result in 60-70\% speed-up. The downside is that if math contains characters that are invalid in the 
+XML mode, such as ampersand, less-than and greater-than, make4ht XML DOM filters will fail. Fortunatelly, 
+make4ht will then switch to the HTML parser mode, so DOM filters will be still executed.
+
+
 \<defined commands\><<<
 \ExplSyntaxOn
+\:CheckOption{fastmathjax}\if:Option
+|<fastmathjax|>
+\else
+|<normalmathjax|>
+\fi
+\ExplSyntaxOff
+>>>
+
+Output verbatim math to HTML without any post-processing. 
+We still need to set the token list to prevent some issues. 
+
+For example, if the processed math contain paragraphs, we would
+get an error because \''\HCode' doesn't like that.
+
+\<fastmathjax\><<<
+\DeclareRobustCommand\alteqtoks[1]{%
+  \tl_set:Ne \l_tmpa_tl {\detokenize{#1}}
+  \HCode{\l_tmpa_tl}
+}
+>>>
+
+Escape illegal XML characters.
+
+\<normalmathjax\><<<
 \cs_new_protected:Npn \alteqtoks #1
 {
   \tl_set:Ne \l_tmpa_tl {\detokenize{#1}}
@@ -92,10 +125,9 @@
   \tl_set:Ne \l_tmpb_tl{ \l_tmpa_tl }
   \HCode{\l_tmpb_tl}
 }
-\ExplSyntaxOff
-
 >>>
 
+
 Provide configuration for MathJax
 
 \<defined commands\><<<

Added: trunk/Master/texmf-dist/tex/generic/tex4ht/qtree.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/qtree.4ht	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/qtree.4ht	2024-11-20 22:20:18 UTC (rev 72917)
@@ -0,0 +1,32 @@
+% qtree.4ht (2024-11-20-13:31), generated from tex4ht-4ht.tex
+% Copyright 2024 TeX Users Group
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3c of this license or (at your option) any
+% later version. The latest version of this license is in
+%   http://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions
+% of LaTeX version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% The Current Maintainer of this work
+% is the TeX4ht Project <http://tug.org/tex4ht>.
+%
+% If you modify this program, changing the
+% version identification would be appreciated.
+\immediate\write-1{version 2024-11-20-13:31}
+
+
+\NewConfigure{qtree}{2}
+
+\pend:def\Tree{\a:qtree}
+\append:def\endTree{\b:qtree}
+
+\Configure{qtree}{\Picture+[\csname a:Picture-alt\endcsname]{}}{\EndPicture}
+
+
+\Hinput{qtree}
+\endinput
+


Property changes on: trunk/Master/texmf-dist/tex/generic/tex4ht/qtree.4ht
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


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