[tex4ht-commits] [SCM] tex4ht updated: r1280 - trunk/lit

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Sat Dec 31 00:31:43 CET 2022


Author: michal_h21
Date: 2022-12-30 23:31:42 +0000 (Fri, 30 Dec 2022)
New Revision: 1280

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
Log:
fixed support for \ in \caption

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2022-12-27 20:16:12 UTC (rev 1279)
+++ trunk/lit/ChangeLog	2022-12-30 23:31:42 UTC (rev 1280)
@@ -1,3 +1,8 @@
+2022-12-30  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (nameref.4ht): fixed support for \\ in \caption.
+	https://tex.stackexchange.com/a/670159/2891
+
 2022-12-27  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): fixed use of \left and

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2022-12-27 20:16:12 UTC (rev 1279)
+++ trunk/lit/tex4ht-4ht.tex	2022-12-30 23:31:42 UTC (rev 1280)
@@ -3499,11 +3499,23 @@
 %   
 % use of \index and \label inside caption results in a fatal error
 % we need to disable them in \NR:Title
+
+% there can be more problematic commands, so we provide a configuration
+% that can be used multiple times - the default value fixes known commands
+% but a user can add more of them
+
+\def\a:captioncommandsfix{}
+\NewConfigure{CaptionCommandsFix}[1]{\concat:config\a:captioncommandsfix{#1}}
+\Configure{CaptionCommandsFix}{
+  \let\index\:gobble%
+  \let\label\:gobble%
+  \let\\\relax% causes issues when \centering is active
+}
+
 \long\def\@caption#1[#2]{%
     \gdef\NR:Type{\@currenvir}%
     \begingroup%
-    \let\index\:gobble%
-    \let\label\:gobble%
+    \a:captioncommandsfix
     \protected at xdef\NR:Title{\a:newlabel{#2}}%
     \endgroup%
    \o:NR@@caption{#1}[{#2}]%
@@ -3552,8 +3564,7 @@
     % handle \label and \index in Caption's package
     % version of \caption
     \begingroup%
-    \let\index\:gobble%
-    \let\label\:gobble%
+    \a:captioncommandsfix
     \protected at xdef\NR:Title{\a:newlabel{##2}}%
     \endgroup%
   }



More information about the tex4ht-commits mailing list.