summaryrefslogtreecommitdiff
path: root/support/TeX4ht/source/tex4ht-4ht.tex
diff options
context:
space:
mode:
Diffstat (limited to 'support/TeX4ht/source/tex4ht-4ht.tex')
-rw-r--r--support/TeX4ht/source/tex4ht-4ht.tex21
1 files changed, 16 insertions, 5 deletions
diff --git a/support/TeX4ht/source/tex4ht-4ht.tex b/support/TeX4ht/source/tex4ht-4ht.tex
index d57d1e294c..8a63480c63 100644
--- a/support/TeX4ht/source/tex4ht-4ht.tex
+++ b/support/TeX4ht/source/tex4ht-4ht.tex
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1278 2022-12-26 19:24:35Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1280 2022-12-30 23:31:42Z michal_h21 $
% tex tex4ht-4ht or ht tex tex4ht-4ht
%
% Copyright 2009-2022 TeX Users Group
@@ -3499,11 +3499,23 @@ definitions.
%
% 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@xdef\NR:Title{\a:newlabel{#2}}%
\endgroup%
\o:NR@@caption{#1}[{#2}]%
@@ -3552,8 +3564,7 @@ definitions.
% handle \label and \index in Caption's package
% version of \caption
\begingroup%
- \let\index\:gobble%
- \let\label\:gobble%
+ \a:captioncommandsfix
\protected@xdef\NR:Title{\a:newlabel{##2}}%
\endgroup%
}