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

michal_h21 at gnu.org.ua michal_h21 at gnu.org.ua
Sat Jan 2 01:09:16 CET 2021


Author: michal_h21
Date: 2021-01-02 02:09:15 +0200 (Sat, 02 Jan 2021)
New Revision: 857

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
   trunk/lit/tex4ht-sty.tex
Log:
fixed \AtBeginDocument issues for hyperref

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2020-12-25 13:31:16 UTC (rev 856)
+++ trunk/lit/ChangeLog	2021-01-02 00:09:15 UTC (rev 857)
@@ -1,3 +1,10 @@
+2021-01-01  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-sty.tex (tex4ht.sty): emulate \AtBeginDocument in .4ht files. 
+	* tex4ht-4ht.tex (hyperref-hooks.4ht, hyperref.4ht, nameref.4ht): fix for
+	issues with \AtBeginDocument.
+	https://puszcza.gnu.org.ua/bugs/index.php?496
+
 2020-12-25  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-sty.tex (tex4ht.sty): use the new LaTeX hook system to execute

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2020-12-25 13:31:16 UTC (rev 856)
+++ trunk/lit/tex4ht-4ht.tex	2021-01-02 00:09:15 UTC (rev 857)
@@ -3300,22 +3300,24 @@
     \o:NRorg at begintheorem{#1}{#2}%
   }%
 
-\AtBeginDocument{%
-  \@ifpackageloaded{listings}{%
+% I don't know if this was useful for anything
+% but we cannot use it anymore
+% \AtBeginDocument{%
+\@ifpackageloaded{listings}{%
       \def\:tempc#1{%
          \gdef\NR:Title{\a:newlabel{listing}}%
          \gdef\NR:Type{lstlisting}%
          \o:NROrg at lst@MakeCaption:{#1}%
          \gdef\@currentlabelname{listing}}
       \HLet\NROrg at lst@MakeCaption\:tempc
-  }{}%
+}{}%
   % bug [348]
-  \def\:tempams{%
+\def\:tempams{%
     \gdef\NR:Title{\a:newlabel{equation}}%
     \gdef\NR:Type{equation}%
     \gdef\@currentlabelname{equation}%
-  }
-  \@ifpackageloaded{amsmath}{%
+}
+\@ifpackageloaded{amsmath}{%
      \Configure{@begin}{align}{\:tempams}
      \Configure{@begin}{multline}{\:tempams}
      \Configure{@begin}{equation}{\:tempams}
@@ -3340,7 +3342,6 @@
      \Configure{@begin}{equation}{\:tempams}
 }
 
-}
 \let\T:ref=\::ref
 \def\::ref{\protect\T at ref}
 \def\T at ref#1{%
@@ -4743,7 +4744,9 @@
 \fi
 >>>
 
-\<nameref.sty\><<<
+The following code breaks with current LaTeX.
+We must requi
+\<nameref.sty not used anymore\><<<
 \@ifpackageloaded{nameref}{}
 {
    \let\sv:label\label
@@ -4753,6 +4756,29 @@
 }
 >>>
 
+We can load nameref from the early hook file
+
+\<add to usepackage\><<<
+\Configure{PackageHooks}{hyperref.sty}{hyperref-hooks.4ht}
+>>>
+
+\<hyperref-hooks.4ht\><<<
+% hyperref-hooks.4ht (|version), generated from |jobname.tex
+% Copyright 2021 TeX Users Group
+|<TeX4ht copyright|>
+\:AtEndOfPackage{%
+\@ifpackageloaded{nameref}{}
+{%
+   \let\sv:label\label
+   \RequirePackage{nameref}%
+   \let\label\sv:label
+   %\input nameref.4ht
+}}
+
+>>> \AddFile{9}{hyperref-hooks}
+
+
+
 \<nameref moved from old hyperref\><<<
 \def\tht:label#1{%
   \@bsphack

Modified: trunk/lit/tex4ht-sty.tex
===================================================================
--- trunk/lit/tex4ht-sty.tex	2020-12-25 13:31:16 UTC (rev 856)
+++ trunk/lit/tex4ht-sty.tex	2021-01-02 00:09:15 UTC (rev 857)
@@ -171,6 +171,8 @@
   \catcode`\%}\catcode`\%|=14\fi
 |<copyright|>
 \ifx  \Preamble\UnDef  \else
+   % fix for LaTeX hook system, \AtBeginDocument is not available at this moment
+   \def\AtBeginDocument#1{\AddToHook{begindocument/end}{#1}}
    \csname expand:after\endcsname{\csname 
        BeforeTeXIVht\endcsname\let\BeforeTeXIVht|=\UnDef}
 \fi



More information about the tex4ht-commits mailing list.