Debian Codegraph @

texmf-dist/tex/latex/footnotehyper/footnotehyper.sty

raw
1 %%
2 %% This is file `footnotehyper.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% footnotehyper.dtx (with options: `package')
8 %%
9 %% IMPORTANT NOTICE:
10 %%
11 %% For the copyright see the source file.
12 %%
13 %% Any modified versions of this file must be renamed
14 %% with new filenames distinct from footnotehyper.sty.
15 %%
16 %% For distribution of the original source see the terms
17 %% for copying and modification in the file footnotehyper.dtx.
18 %%
19 %% This generated file may be distributed as long as the
20 %% original source files, as listed above, are part of the
21 %% same distribution. (The sources need not necessarily be
22 %% in the same archive or directory.)
23 %%
24 \NeedsTeXFormat{LaTeX2e}
25 \ProvidesPackage{footnotehyper}%
26 [2025/11/15 v1.1f hyperref aware footnote.sty (JFB)]
27 %%
28 %% Package: footnotehyper
29 %% Version: 1.1f (2025/11/15)
30 %% License: LPPL 1.3c
31 %% Copyright (C) 2016-2021, 2025 Jean-Francois Burnol
32 %% <jfbu at free dot fr>.
33 %%
34 \newif\iffootnotehyperparse\footnotehyperparsetrue
35 \newif\iffootnotehyperwarn \footnotehyperwarntrue
36 \def\FNH@msgbk{^^J(footnotehyper)\@spaces}% make room for message lines
37 \DeclareOption*%
38 {\PackageWarning{footnotehyper}{Option `\CurrentOption' is unknown}}%
39 \ProcessOptions\relax
40 \@ifclassloaded{beamer}
41 {\PackageWarningNoLine{footnotehyper}{This package is
42 incompatible with the beamer class. Aborting input..}%
43 \endinput}
44 {}%
45 \newbox\FNH@notes
46 \newdimen\FNH@width
47 \newtoks\FNH@toks % 1.1c
48 \let\FNH@colwidth\columnwidth
49 \newif\ifFNH@savingnotes
50 \AtBeginDocument {%
51 \let\FNH@latex@footnote \footnote
52 \let\FNH@latex@footnotetext\footnotetext
53 \let\FNH@H@@footnotetext \@footnotetext
54 \let\FNH@H@@mpfootnotetext \@mpfootnotetext
55 \newenvironment{savenotes}
56 {\FNH@savenotes\ignorespaces}{\FNH@spewnotes\ignorespacesafterend}%
57 \let\spewnotes \FNH@spewnotes
58 \let\footnote \FNH@footnote
59 \let\footnotetext \FNH@footnotetext
60 \let\endfootnote \FNH@endfntext
61 \let\endfootnotetext\FNH@endfntext
62 \@ifpackageloaded{hyperref}
63 {\ifHy@hyperfootnotes
64 \let\FNH@H@@footnotetext\H@@footnotetext
65 \let\FNH@H@@mpfootnotetext\H@@mpfootnotetext
66 \else
67 \let\FNH@hyper@fntext\FNH@nohyp@fntext
68 \fi}%
69 {\let\FNH@hyper@fntext\FNH@nohyp@fntext}%
70 }%
71 \def\FNH@hyper@fntext{\FNH@fntext\FNH@hyper@fntext@i}%
72 \def\FNH@nohyp@fntext{\FNH@fntext\FNH@nohyp@fntext@i}%
73 \def\FNH@fntext #1{\ifx\ifmeasuring@\@undefined
74 \expandafter\@secondoftwo\else\expandafter\@firstofone\fi
75 {\ifmeasuring@\expandafter\@gobbletwo\fi}#1%
76 }%
77 \long\def\FNH@hyper@fntext@i#1{%
78 \global\setbox\FNH@notes\vbox
79 {\unvbox\FNH@notes
80 \FNH@startnote
81 \@makefntext
82 {\rule\z@\footnotesep\ignorespaces
83 \ifHy@nesting\expandafter\ltx@firstoftwo
84 \else\expandafter\ltx@secondoftwo
85 \fi
86 {\expandafter\hyper@@anchor\expandafter{\Hy@footnote@currentHref}{#1}}%
87 {\Hy@raisedlink
88 {\expandafter\hyper@@anchor\expandafter{\Hy@footnote@currentHref}%
89 {\relax}}%
90 \let\@currentHref\Hy@footnote@currentHref
91 \let\@currentlabelname\@empty
92 #1}%
93 \@finalstrut\strutbox
94 }%
95 \FNH@endnote
96 }%
97 }%
98 \long\def\FNH@nohyp@fntext@i#1{%
99 \global\setbox\FNH@notes\vbox
100 {\unvbox\FNH@notes
101 \FNH@startnote
102 \@makefntext{\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
103 \FNH@endnote
104 }%
105 }%
106 \def\FNH@startnote{%
107 \hsize\FNH@colwidth
108 \interlinepenalty\interfootnotelinepenalty
109 \reset@font\footnotesize
110 \floatingpenalty\@MM% Is this right???
111 \@parboxrestore
112 \protected@edef\@currentlabel{\csname p@\@mpfn\endcsname\@thefnmark}%
113 \color@begingroup
114 }%
115 \def\FNH@endnote{\color@endgroup}%
116 \def\FNH@savenotes{%
117 \begingroup
118 \ifFNH@savingnotes\else
119 \FNH@savingnotestrue
120 \let\@footnotetext \FNH@hyper@fntext
121 \let\@mpfootnotetext \FNH@hyper@fntext
122 \let\H@@mpfootnotetext\FNH@nohyp@fntext % fool hyperref's \@xfootnotenext
123 \FNH@width\columnwidth
124 \let\FNH@colwidth\FNH@width
125 \global\setbox\FNH@notes\box\voidb@x
126 \let\FNH@thempfn\thempfn
127 \let\FNH@mpfn\@mpfn
128 \ifx\@minipagerestore\relax\let\@minipagerestore\@empty\fi
129 \expandafter\def\expandafter\@minipagerestore\expandafter{%
130 \@minipagerestore
131 \let\thempfn\FNH@thempfn
132 \let\@mpfn\FNH@mpfn
133 }%
134 \fi
135 }%
136 \def\FNH@spewnotes {%
137 \if@endpe\ifx\par\@@par\FNH@toks{}\else
138 \FNH@toks\expandafter{\expandafter
139 \def\expandafter\par\expandafter{\par}\@endpetrue}%
140 \expandafter\expandafter\expandafter
141 \FNH@toks
142 \expandafter\expandafter\expandafter
143 {\expandafter\the\expandafter\FNH@toks
144 \expandafter\def\expandafter\@par\expandafter{\@par}}%
145 \expandafter\expandafter\expandafter
146 \FNH@toks
147 \expandafter\expandafter\expandafter
148 {\expandafter\the\expandafter\FNH@toks
149 \expandafter\everypar\expandafter{\the\everypar}}\fi
150 \else\FNH@toks{}\fi
151 \expandafter
152 \endgroup\the\FNH@toks
153 \ifFNH@savingnotes\else
154 \ifvoid\FNH@notes\else
155 \begingroup
156 \let\@makefntext\@empty
157 \let\@finalstrut\@gobble
158 \let\rule\@gobbletwo
159 \ifx\@footnotetext\@mpfootnotetext
160 \expandafter\FNH@H@@mpfootnotetext
161 \else
162 \expandafter\FNH@H@@footnotetext
163 \fi{\unvbox\FNH@notes}%
164 \endgroup
165 \fi
166 \fi
167 }%
168 \def\FNH@footnote@envname {footnote}%
169 \def\FNH@footnotetext@envname{footnotetext}%
170 \def\FNH@footnote{%
171 \ifx\@currenvir\FNH@footnote@envname
172 \expandafter\FNH@footnoteenv
173 \else
174 \expandafter\FNH@latex@footnote
175 \fi
176 }%
177 \def\FNH@footnoteenv{%
178 \@ifnextchar[%
179 \FNH@footnoteenv@i %]
180 {\stepcounter\@mpfn
181 \protected@xdef\@thefnmark{\thempfn}%
182 \@footnotemark
183 \def\FNH@endfntext@fntext{\@footnotetext}%
184 \FNH@startfntext}%
185 }%
186 \def\FNH@footnoteenv@i[#1]{%
187 \begingroup
188 \csname c@\@mpfn\endcsname #1\relax
189 \unrestored@protected@xdef\@thefnmark{\thempfn}%
190 \endgroup
191 \@footnotemark
192 \def\FNH@endfntext@fntext{\@footnotetext}%
193 \FNH@startfntext
194 }%
195 \def\FNH@footnotetext{%
196 \ifx\@currenvir\FNH@footnotetext@envname
197 \expandafter\FNH@footnotetextenv
198 \else
199 \expandafter\FNH@latex@footnotetext
200 \fi
201 }%
202 \def\FNH@footnotetextenv{%
203 \@ifnextchar[%
204 \FNH@footnotetextenv@i %]
205 {\protected@xdef\@thefnmark{\thempfn}%
206 \def\FNH@endfntext@fntext{\@footnotetext}%
207 \FNH@startfntext}%
208 }%
209 \def\FNH@footnotetextenv@i[#1]{%
210 \begingroup
211 \csname c@\@mpfn\endcsname #1\relax
212 \unrestored@protected@xdef\@thefnmark{\thempfn}%
213 \endgroup
214 \ifFNH@savingnotes
215 \def\FNH@endfntext@fntext{\FNH@nohyp@fntext}%
216 \else
217 \def\FNH@endfntext@fntext{\FNH@H@@footnotetext}%
218 \fi
219 \FNH@startfntext
220 }%
221 \def\FNH@startfntext{%
222 \setbox\z@\vbox\bgroup
223 \FNH@startnote
224 \FNH@prefntext
225 \rule\z@\footnotesep\ignorespaces
226 }%
227 \def\FNH@endfntext {%
228 \@finalstrut\strutbox
229 \FNH@postfntext
230 \FNH@endnote
231 \egroup
232 \begingroup
233 \let\@makefntext\@empty\let\@finalstrut\@gobble\let\rule\@gobbletwo
234 \FNH@endfntext@fntext {\unvbox\z@}%
235 \endgroup
236 }%
237 \let\FNH@prefntext\@empty
238 \let\FNH@postfntext\@empty
239 \AtBeginDocument{\iffootnotehyperparse\expandafter\FNH@check\fi}%
240 \def\FNH@safeif#1{%
241 \iftrue\csname if#1\endcsname\csname fi\endcsname\expandafter\@firstoftwo
242 \else\csname fi\endcsname\expandafter\@secondoftwo
243 \fi
244 }%
245 \def\FNH@check{%
246 \ifx\@makefntextFB\@undefined
247 \expandafter\FNH@check@
248 \else
249 \providecommand\localleftbox[1]{}%
250 \expandafter\FNH@frenchb@
251 \fi
252 }%
253 \def\FNH@frenchb@{%
254 \def\FNH@prefntext{%
255 \localleftbox{}%
256 \let\FBeverypar@save\FBeverypar@quote
257 \let\FBeverypar@quote\relax
258 \FNH@safeif{FB@koma}%
259 {\FNH@safeif{FBFrenchFootnotes}%
260 {\ifx\footnote\thanks
261 \let\@@makefnmark\@@makefnmarkTH
262 \@makefntextTH{} % space as in french.ldf
263 \else
264 \let\@@makefnmark\@@makefnmarkFB
265 \@makefntextFB{} % space as in french.ldf
266 \fi
267 }{\let\@@makefnmark\@@makefnmarkORI
268 \@makefntextORI{}% no space as in french.ldf
269 }%
270 }%
271 {\FNH@safeif{FBFrenchFootnotes}%
272 {\@makefntextFB{}}%
273 {\@makefntextORI{}}%
274 }%
275 }%
276 \def\FNH@postfntext{%
277 \let\FBeverypar@quote\FBeverypar@save
278 \localleftbox{\FBeveryline@quote}%
279 }%
280 \iffootnotehyperwarn
281 \PackageInfo{footnotehyper}%
282 {babel-french compatibility patch activated.\FNH@msgbk
283 It may not work with all combinations of classes/packages.\FNH@msgbk
284 In case of problems with the `footnote' or `footnotetext'\FNH@msgbk
285 environments, you may try sending to the author a small\FNH@msgbk
286 file demonstrating the problem.\FNH@msgbk
287 To turn off this message, add \string\footnotehyperwarnfalse\FNH@msgbk
288 to the preamble\@gobble}%
289 \fi
290 }%
291 \def\FNH@check@{%
292 \expandafter\FNH@check@a\@makefntext{1.2!3?4,}%
293 \FNH@@@1.2!3?4,\FNH@@@\relax
294 }%
295 \long\def\FNH@check@a #11.2!3?4,#2\FNH@@@#3{%
296 \ifx\relax#3\expandafter\FNH@checkagain@
297 \else
298 \def\FNH@prefntext{#1}\def\FNH@postfntext{#2}%
299 \expandafter\FNH@check@b
300 \fi
301 }%
302 \def\FNH@checkagain@{%
303 \expandafter\FNH@checkagain@a
304 \detokenize\expandafter{\@makefntext{1.2!3?4,}}\relax\FNH@@@
305 }%
306 \edef\FNH@temp{\noexpand\FNH@checkagain@a ##1\string{1.2!3?4,\string}}%
307 \expandafter\def\FNH@temp#2#3\FNH@@@{%
308 \ifx\relax#2%
309 \def\FNH@prefntext{\@makefntext{}}%
310 \iffootnotehyperwarn
311 \PackageInfo{footnotehyper}%
312 {Using the \string\@makefntext{} approach (see doc).\FNH@msgbk
313 In case of dysfunctional footnote environments, you can\FNH@msgbk
314 try sending the author a small illustrative document.\FNH@msgbk
315 To turn off this message, add \string\footnotehyperwarnfalse\FNH@msgbk
316 to the preamble\@gobble}% "noline"
317 \fi
318 \else\FNH@bad@makefntext@alert
319 \fi
320 }%
321 \def\FNH@check@b #1\relax{%
322 \expandafter\expandafter\expandafter\FNH@check@c
323 \expandafter\meaning\expandafter\FNH@prefntext
324 \meaning\[email protected]!3?4,\FNH@check@c\relax
325 }%
326 \def\FNH@check@c #11.2!3?4,#2#3\relax{%
327 \ifx\FNH@check@c#2\else\FNH@bad@makefntext@alert\fi
328 }%
329 \def\FNH@bad@makefntext@alert{%
330 \iffootnotehyperwarn
331 \PackageWarningNoLine{footnotehyper}%
332 {\FNH@msgbk
333 Failed to analyse \string\@makefntext\space into something usable.\FNH@msgbk
334 Using as fall-back the article class code.\FNH@msgbk
335 You may try to email the author this problematic meaning:\FNH@msgbk
336 \meaning\@makefntext\FNH@msgbk
337 together with the document preamble (in particular if\FNH@msgbk
338 footnote numbers do not show at bottom of page)}%
339 \fi
340 \let\FNH@prefntext \FNH@prefntext@fallback
341 \let\FNH@postfntext\FNH@postfntext@fallback
342 }%
343 \def\FNH@prefntext@fallback{% from article class code with \@nameuse added
344 \parindent 1em\noindent
345 \hb@[email protected]{\hss\@textsuperscript{\normalfont\@nameuse{@thefnmark}}}%
346 }%
347 \let\FNH@postfntext@fallback\@empty
348 \def\makesavenoteenv{\@ifnextchar[\FNH@msne@ii\FNH@msne@i}%]
349 \def\FNH@msne@i #1{%
350 \expandafter\let\csname FNH$#1\expandafter\endcsname %$
351 \csname #1\endcsname
352 \expandafter\let\csname endFNH$#1\expandafter\endcsname %$
353 \csname end#1\endcsname
354 \FNH@msne@ii[#1]{FNH$#1}%$
355 }%
356 \def\FNH@msne@ii[#1]#2{%
357 \expandafter\edef\csname#1\endcsname{%
358 \noexpand\savenotes
359 \expandafter\noexpand\csname#2\endcsname
360 }%
361 \expandafter\edef\csname end#1\endcsname{%
362 \expandafter\noexpand\csname end#2\endcsname
363 \noexpand\expandafter
364 \noexpand\spewnotes
365 \noexpand\if@endpe\noexpand\@endpetrue\noexpand\fi
366 }%
367 }%
368 \@ifl@t@r\fmtversion{2020/10/01}{%
369 \def\FNH@msne@i#1{%
370 \AddToHook{env/#1/before}{\savenotes}%
371 \AddToHook{env/#1/after}{\spewnotes}%
372 }%
373 \def\FNH@msne@ii[#1]#2{%
374 \newenvironment{#1}{\begin{savenotes}\begin{#2}}%
375 {\end{#2}\end{savenotes}}%
376 }%
377 }%
378 {}%
379 \endinput
380 %%
381 %% End of file `footnotehyper.sty'.