From 67b7f1ecb6dce63c006dfca50de45245364f1e8c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 30 Dec 2022 23:46:36 +0000 Subject: \\ in \caption, tex4ht r1280 git-svn-id: svn://tug.org/texlive/trunk@65410 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/generic/tex4ht/ChangeLog | 5 +++++ .../source/generic/tex4ht/tex4ht-4ht.tex | 21 +++++++++++++++----- Master/texmf-dist/tex/generic/tex4ht/nameref.4ht | 23 ++++++++++++++++------ 3 files changed, 38 insertions(+), 11 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/source/generic/tex4ht/ChangeLog b/Master/texmf-dist/source/generic/tex4ht/ChangeLog index 7dd31c7566e..d998456db1f 100644 --- a/Master/texmf-dist/source/generic/tex4ht/ChangeLog +++ b/Master/texmf-dist/source/generic/tex4ht/ChangeLog @@ -1,3 +1,8 @@ +2022-12-30 Michal Hoftich + + * tex4ht-4ht.tex (nameref.4ht): fixed support for \\ in \caption. + https://tex.stackexchange.com/a/670159/2891 + 2022-12-27 Michal Hoftich * tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): fixed use of \left and diff --git a/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex b/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex index d57d1e294c0..8a63480c63c 100644 --- a/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex +++ b/Master/texmf-dist/source/generic/tex4ht/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% } diff --git a/Master/texmf-dist/tex/generic/tex4ht/nameref.4ht b/Master/texmf-dist/tex/generic/tex4ht/nameref.4ht index b99de6ca5e1..f849d7c7bfc 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/nameref.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/nameref.4ht @@ -1,4 +1,4 @@ -% nameref.4ht (2022-11-21-13:02), generated from tex4ht-4ht.tex +% nameref.4ht (2022-12-30-15:46), generated from tex4ht-4ht.tex % Copyright 2005-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-11-21-13:02} +\immediate\write-1{version 2022-12-30-15:46} \let\NR:Type\relax \let\ltx@label\label @@ -88,11 +88,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@xdef\NR:Title{\a:newlabel{#2}}% \endgroup% \o:NR@@caption{#1}[{#2}]% @@ -141,8 +153,7 @@ % 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% } -- cgit v1.2.3