texlive[63684] Master/texmf-dist: \index inside \caption, tex4ht
commits+karl at tug.org
commits+karl at tug.org
Tue Jun 21 23:07:31 CEST 2022
Revision: 63684
http://tug.org/svn/texlive?view=revision&revision=63684
Author: karl
Date: 2022-06-21 23:07:31 +0200 (Tue, 21 Jun 2022)
Log Message:
-----------
\index inside \caption, tex4ht r1158
Revision Links:
--------------
http://tug.org/svn/texlive?view=revision&revision=1158
Modified Paths:
--------------
trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex
trunk/Master/texmf-dist/tex/generic/tex4ht/latex.4ht
Modified: trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog 2022-06-21 20:23:29 UTC (rev 63683)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog 2022-06-21 21:07:31 UTC (rev 63684)
@@ -1,3 +1,9 @@
+2022-06-21 Michal Hoftich <michal.h21 at gmail.com>
+
+ * tex4ht-4ht.tex (latex.4ht): fixed support for \index commands
+ inside \caption.
+ https://tex.stackexchange.com/a/647924/2891
+
2022-06-20 Michal Hoftich <michal.h21 at gmail.com>
* tex4ht-4ht.tex (pdfpages.4ht): added support for the Pdfpages
Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex 2022-06-21 20:23:29 UTC (rev 63683)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex 2022-06-21 21:07:31 UTC (rev 63684)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1157 2022-06-20 13:49:01Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1158 2022-06-21 15:56:07Z michal_h21 $
% tex tex4ht-4ht or ht tex tex4ht-4ht
%
% Copyright 2009-2022 TeX Users Group
@@ -11487,15 +11487,41 @@
\`'.lot' (list of tables) and \`'lof' (list of figures) files.
\<latex ltfloat\><<<
+|<latex caption index|>
\long\def\:tempc#1[#2]#3{\par \cur:lbl{}%
|<write caption to toc|>\begingroup
+ |<latex caption index save|>
\@parboxrestore \normalsize
\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
- \endgroup |<cancel if-label anchors|>}
+ \endgroup
+|<latex caption index print|>
+|<cancel if-label anchors|>}
\def\numberline#1{\hbox to\@tempdima{#1\hfil} }
\HLet\@caption|=\:tempc
>>>
+The index commands used inside caption may result in fatal error.
+We use the LaTeX 3 sequences to save their contents inside caption,
+and print them when it is safe.
+
+\<latex caption index\><<<
+\ExplSyntaxOn
+\seq_new:N\:savedindex
+\def\:initsaveindex{\seq_gclear:N\:savedindex}
+\def\:saveindex#1{\seq_gput_right:Nn\:savedindex{#1}}
+\def\:printsavedindex{\seq_map_inline:Nn\:savedindex{\index{##1}}}
+\ExplSyntaxOff
+>>>
+
+\<latex caption index save\><<<
+\:initsaveindex%
+\let\index\:saveindex%
+>>>
+
+\<latex caption index print\><<<
+\:printsavedindex%
+>>>
+
The \''|<cancel if-label anchors|>' request no
the \''\label' commands to avoid duplicating the anchor already set by the
\''\caption' command.
Modified: trunk/Master/texmf-dist/tex/generic/tex4ht/latex.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/latex.4ht 2022-06-21 20:23:29 UTC (rev 63683)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/latex.4ht 2022-06-21 21:07:31 UTC (rev 63684)
@@ -1,4 +1,4 @@
-% latex.4ht (2022-06-09-13:58), generated from tex4ht-4ht.tex
+% latex.4ht (2022-06-21-13:58), generated from tex4ht-4ht.tex
% Copyright 1997-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-06-09-13:58}
+\immediate\write-1{version 2022-06-21-13:58}
\ifx\SaveMkHalignConf:g\:UnDef \else \expandafter\endinput\fi
@@ -1412,6 +1412,13 @@
\def\af:float{#4}}
\gHAssign\capt:cnt0
\Configure{float}{}{}{}
+\ExplSyntaxOn
+\seq_new:N\:savedindex
+\def\:initsaveindex{\seq_gclear:N\:savedindex}
+\def\:saveindex#1{\seq_gput_right:Nn\:savedindex{#1}}
+\def\:printsavedindex{\seq_map_inline:Nn\:savedindex{\index{##1}}}
+\ExplSyntaxOff
+
\long\def\:tempc#1[#2]#3{\par \cur:lbl{}%
\begingroup
\gHAdvance\TitleCount by 1
@@ -1427,9 +1434,15 @@
{#1}\relax}}\:temp
\endgroup
\begingroup
+ \:initsaveindex%
+\let\index\:saveindex%
+
\@parboxrestore \normalsize
\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
- \endgroup \let\skip:anchor\:UnDef
+ \endgroup
+\:printsavedindex%
+
+\let\skip:anchor\:UnDef
}
\def\numberline#1{\hbox to\@tempdima{#1\hfil} }
\HLet\@caption\:tempc
@@ -2309,7 +2322,7 @@
\expandafter\:temp\usepackage!*?:
\def\:tempa{\@latex at e@error}
\ifx \:temp\:tempa
- % latex209.4ht (2022-06-09-13:58), generated from tex4ht-4ht.tex
+ % latex209.4ht (2022-06-21-13:58), generated from tex4ht-4ht.tex
% Copyright 1997-2009 Eitan M. Gurari
% Copyright 2009-2022 TeX Users Group
%
@@ -2328,7 +2341,7 @@
%
% If you modify this program, changing the
% version identification would be appreciated.
-\immediate\write-1{version 2022-06-09-13:58}
+\immediate\write-1{version 2022-06-21-13:58}
\let\:fnsymbol\@fnsymbol
\def\@fnsymbol#1{{\hbox{$\:fnsymbol{#1}$}}}
More information about the tex-live-commits
mailing list.