[tex4ht-commits] [SCM] tex4ht updated: r1158 - trunk/lit
Michal Hoftich
INVALID.NOREPLY at gnu.org.ua
Tue Jun 21 17:56:07 CEST 2022
Author: michal_h21
Date: 2022-06-21 15:56:07 +0000 (Tue, 21 Jun 2022)
New Revision: 1158
Modified:
trunk/lit/ChangeLog
trunk/lit/tex4ht-4ht.tex
Log:
fixed support for the index command inside caption
Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog 2022-06-20 13:49:01 UTC (rev 1157)
+++ trunk/lit/ChangeLog 2022-06-21 15:56:07 UTC (rev 1158)
@@ -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/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex 2022-06-20 13:49:01 UTC (rev 1157)
+++ trunk/lit/tex4ht-4ht.tex 2022-06-21 15:56:07 UTC (rev 1158)
@@ -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.
More information about the tex4ht-commits
mailing list.