texlive[72882] Master/texmf-dist: manyfoot links, tex4ht r1597

commits+karl at tug.org commits+karl at tug.org
Sun Nov 17 23:35:13 CET 2024


Revision: 72882
          https://tug.org/svn/texlive?view=revision&revision=72882
Author:   karl
Date:     2024-11-17 23:35:13 +0100 (Sun, 17 Nov 2024)
Log Message:
-----------
manyfoot links, tex4ht r1597

Revision Links:
--------------
    https://tug.org/svn/texlive?view=revision&revision=1597

Modified Paths:
--------------
    trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex
    trunk/Master/texmf-dist/tex/generic/tex4ht/manyfoot-hooks.4ht

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex	2024-11-17 21:53:51 UTC (rev 72881)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex	2024-11-17 22:35:13 UTC (rev 72882)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1596 2024-11-17 16:26:25Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1597 2024-11-17 22:03:56Z michal_h21 $
 % tex tex4ht-4ht   or   ht tex tex4ht-4ht
 %
 % Copyright 2009-2024 TeX Users Group    
@@ -38525,24 +38525,34 @@
 commands, and redefines them to produce normal footnotes, just with 
 changed footnote mark. 
 
-As we call original \''\footnote', we must also take care of the footnote
-counter.
 
 See \Link[https://tex.stackexchange.com/a/729975/2891]{}{} this answer\EndLink 
 for an example.
 
+As we call original \''\footnote', we must also take care of the footnote
+counters and links. As different footnote types will produce the 
+same footnote numbers, these numbers will produce duplicate links. 
+To avoid that, we add a suffix to \''\minipageNum'.
+
 \<declare manyfoot footnote\><<<
 \let\o:MFL at declare:\MFL at declare
-\newcounter{orig:footnote}
+
 \def\manyfoot:declarefn#1{%
   \expandafter\renewcommand\csname footnote#1\endcsname[1]{%
-    \stepcounter{footnote#1}%
+    % save original footnote counters 
     \let\:origthefootnote\thefootnote%
-    \setcounter{orig:footnote}{\c at footnote}%
+    \let\:origmpfn\@mpfn%
+    \let\:origminipageNum\minipageNum%
+    % \minipageNum is used in footnote links. we add the current suffix to produce unique links
+    % if different footnote types use the same number
+    \edef\minipageNum{\minipageNum #1}%
     \renewcommand\thefootnote{\csname thefootnote#1\endcsname}%
+    % declare which counter should be used
+    \def\@mpfn{footnote#1}
     \footnote{##1}%
     \let\thefootnote\:origthefootnote%
-    \setcounter{footnote}{\c at orig:footnote}
+    \let\@mpfn\:origmpfn%
+    \let\minipageNum\:origminipageNum%
   }%
 }
 

Modified: trunk/Master/texmf-dist/tex/generic/tex4ht/manyfoot-hooks.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/manyfoot-hooks.4ht	2024-11-17 21:53:51 UTC (rev 72881)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/manyfoot-hooks.4ht	2024-11-17 22:35:13 UTC (rev 72882)
@@ -1,4 +1,4 @@
-% manyfoot-hooks.4ht (2024-11-17-13:28), generated from tex4ht-4ht.tex
+% manyfoot-hooks.4ht (2024-11-17-14:33), generated from tex4ht-4ht.tex
 % Copyright 2024 TeX Users Group
 %
 % This work may be distributed and/or modified under the
@@ -16,21 +16,28 @@
 %
 % If you modify this program, changing the
 % version identification would be appreciated.
-\immediate\write-1{version 2024-11-17-13:28}
+\immediate\write-1{version 2024-11-17-14:33}
 
 
 \:AtEndOfPackage{%
 \let\o:MFL at declare:\MFL at declare
-\newcounter{orig:footnote}
+
 \def\manyfoot:declarefn#1{%
   \expandafter\renewcommand\csname footnote#1\endcsname[1]{%
-    \stepcounter{footnote#1}%
+    % save original footnote counters
     \let\:origthefootnote\thefootnote%
-    \setcounter{orig:footnote}{\c at footnote}%
+    \let\:origmpfn\@mpfn%
+    \let\:origminipageNum\minipageNum%
+    % \minipageNum is used in footnote links. we add the current suffix to produce unique links
+    % if different footnote types use the same number
+    \edef\minipageNum{\minipageNum #1}%
     \renewcommand\thefootnote{\csname thefootnote#1\endcsname}%
+    % declare which counter should be used
+    \def\@mpfn{footnote#1}
     \footnote{##1}%
     \let\thefootnote\:origthefootnote%
-    \setcounter{footnote}{\c at orig:footnote}
+    \let\@mpfn\:origmpfn%
+    \let\minipageNum\:origminipageNum%
   }%
 }
 



More information about the tex-live-commits mailing list.