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

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Sun Oct 13 13:33:57 CEST 2024


Author: michal_h21
Date: 2024-10-13 11:33:56 +0000 (Sun, 13 Oct 2024)
New Revision: 1581

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
Log:
fixed support for LaTeX hooks in \@sect and \@ssect

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2024-10-10 21:27:16 UTC (rev 1580)
+++ trunk/lit/ChangeLog	2024-10-13 11:33:56 UTC (rev 1581)
@@ -1,3 +1,9 @@
+2024-10-13  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (latex.4ht): fixed support for LaTeX cmd hooks in
+	\@sect and \@ssect commands.
+	http://puszcza.gnu.org.ua/bugs/?639
+
 2024-10-10  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-mathml.tex (mathml.4ht): removed spurious space after

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2024-10-10 21:27:16 UTC (rev 1580)
+++ trunk/lit/tex4ht-4ht.tex	2024-10-13 11:33:56 UTC (rev 1581)
@@ -12067,14 +12067,32 @@
 \def\no at sect#1#2#3#4#5{\no:sect{#1}{#2}{#3}{#4}{0ex}}
 >>>
 
+The LaTeX command hook mechanism doesn't like our redefinitions of 
+\''\@sect' and \''\@ssect', so we need to declare and use them explicitly. 
+Otherwise, packages that try to add hooks to these commands may cause errors.
+See \Link[http://puszcza.gnu.org.ua/bugs/?639]{}{} this bug report\EndLink.
+
 \<latex ltsect\><<<
+\NewHookWithArguments{cmd/@sect/before}{8}
+\NewReversedHookWithArguments{cmd/@sect/after}{8}
+\NewHookWithArguments{cmd/@ssect/before}{5}
+\NewReversedHookWithArguments{cmd/@ssect/after}{5}
+>>>
+
+\<latex ltsect\><<<
 \let\no at ssect|=\@ssect
-\def\@ssect#1#2#3#4#5{\:Sc3
-   \no at ssect{#1}{#2}{#3}{#4}{\:Sc4#5\:Sc2}\HtmlEnv}
+\def\@ssect#1#2#3#4#5{%
+  \UseHookWithArguments{cmd/@ssect/before}{5}{##1}{##2}{##3}{##4}{##5}%
+  \:Sc3\no at ssect{#1}{#2}{#3}{#4}{\:Sc4#5\:Sc2}\HtmlEnv%
+  \UseHookWithArguments{cmd/@ssect/after}{5}{##1}{##2}{##3}{##4}{##5}%
+}
 \let\no at sect|=\@sect
 \def\@sect#1#2#3#4#5#6[#7]#8{%
-   \xdef\c:secnumdepth{#2}\:Sc3
-   \no at sect{#1}{#2}{#3}{#4}{#5}{#6}[#7]{\:Sc4#8\:Sc2}\HtmlEnv}
+   \UseHookWithArguments{cmd/@sect/before}{8}{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}%
+   \xdef\c:secnumdepth{#2}\:Sc3%
+   \no at sect{#1}{#2}{#3}{#4}{#5}{#6}[#7]{\:Sc4#8\:Sc2}\HtmlEnv%
+   \UseHookWithArguments{cmd/@sect/after}{8}{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}%
+ }
 \let\:startsection|=\@startsection
 \def\@startsection#1{\@ifstar{\Configure{secType}{like#1}}%
    {\Configure{secType}{#1}}%
@@ -12119,6 +12137,7 @@
 
 \<redf sec\><<<
 \def\@sect##1##2##3##4##5##6[##7]##8{%
+   \UseHookWithArguments{cmd/@sect/before}{8}{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}%
    |<disable @seccntformat|>%
    \let\@sect|=\no at sect   \xdef\c:secnumdepth{##2}%
    {\SkipRefstepAnchor \let\addcontentsline|=\:gobbleIII \let\mark|=\:gobble
@@ -12125,7 +12144,9 @@
     \no at sect{##1}{##2}{##3}{##4}{##5}{##6}[{##7}]{}}%
    |<recall Sc, sec, ssec|>%
    |<restore @seccntformat|>%
-   \HtmlEnv    \Toc:Title{##7}\csname no:#1\endcsname{##8}}%
+   \HtmlEnv    \Toc:Title{##7}\csname no:#1\endcsname{##8}%
+   \UseHookWithArguments{cmd/@sect/after}{8}{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}%
+ }%
 >>>
 
 In the above we want \`'[{##7}]' instead of \`'[##7]', in case `]' is
@@ -12135,12 +12156,15 @@
 
 \<redf ssec\><<<
 \def\@ssect##1##2##3##4##5{%
+   \UseHookWithArguments{cmd/@ssect/before}{5}{##1}{##2}{##3}{##4}{##5}%
    |<star sec title|>%
    \let\@ssect|=\no at ssect
    {\def\addcontentsline####1####2####3{}%
     \no at ssect{##1}{##2}{##3}{##4}{}}%
    |<recall Sc, sec, ssec|>%
-   \HtmlEnv   \csname :like#1\endcsname{##5}}%
+   \HtmlEnv   \csname :like#1\endcsname{##5}%
+   \UseHookWithArguments{cmd/@ssect/after}{5}{##1}{##2}{##3}{##4}{##5}%
+ }%
 >>>
 
 \<sv Sc, sec, ssec\><<<



More information about the tex4ht-commits mailing list.