Debian Codegraph @

texmf-dist/tex/latex/latex-lab/latex-lab-footmisc.ltx

raw
1 %%
2 %% This is file `latex-lab-footmisc.ltx',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% latex-lab-footnotes.dtx (with options: `footmisc')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright 2021-2025 LaTeX Project
12 %%
13 %% This file was generated from file(s) of the `LaTeX-lab Bundle'.
14 %% ------------------------------------------------------------------------------------
15 %%
16 %% It may be distributed and/or modified under the
17 %% conditions of the LaTeX Project Public License, either version 1.3c
18 %% of this license or (at your option) any later version.
19 %% The latest version of this license is in
20 %% http://www.latex-project.org/lppl.txt
21 %% and version 1.3c or later is part of all distributions of LaTeX
22 %% version 2008 or later.
23 %%
24 %% This file may only be distributed together with a copy of the LaTeX
25 %% `LaTeX-lab Bundle'. You may however distribute the `LaTeX-lab Bundle'
26 %% without such generated files.
27 %%
28 %% The newest sources can be found below
29 %%
30 %% https://github.com/latex3/latex2e/required/latex-lab
31 %%
32 %% where one can also log issues in case there are any.
33 %%
34 %%
35 %% File: latex-lab-footnotes.dtx
36 \def\ltlabfootnotedate{2025-07-04}
37 \def\ltlabfootnoteversion{0.8o}
38
39 %%
40 %% Copyright (c) 1995-2011 Robin Fairbairns
41 %% Copyright (c) 2018-2023 Robin Fairbairns, Frank Mittelbach
42 %%
43 %% This file is part of the `latex-lab Bundle'.
44 %% --------------------------------------------
45 %%
46 %% It may be distributed and/or modified under the
47 %% conditions of the LaTeX Project Public License, either version 1.3c
48 %% of this license or (at your option) any later version.
49 %% The latest version of this license is in
50 %% https://www.latex-project.org/lppl.txt
51 %% and version 1.3c or later is part of all distributions of LaTeX
52 %% version 2008 or later.
53 %%
54 %% This work has the LPPL maintenance status 'maintained'.
55 %%
56 \NeedsTeXFormat{LaTeX2e}
57 \providecommand\DeclareRelease[3]{}
58 \providecommand\DeclareCurrentRelease[2]{}
59
60 \DeclareRelease{v5}{2011-06-06}{footmisc-2011-06-06.sty}
61 \DeclareCurrentRelease{}{2022-02-14}
62 \ProvidesPackage{latex-lab-footmisc}%
63 [2025/02/20 v6.0e
64 a miscellany of footnote facilities -- latex-lab version%
65 ]
66
67 \NeedsTeXFormat{LaTeX2e}[2020/10/01]
68 \newtoks\FN@temptoken
69 \providecommand\protected@writeaux{%
70 \protected@write\@auxout
71 }
72 \def\l@advance@macro{\@@dvance@macro\edef}
73 \def\@@dvance@macro#1#2#3{\expandafter\@tempcnta#2\relax
74 \advance\@tempcnta#3\relax
75 #1#2{\the\@tempcnta}%
76 }
77 \let\@advance@macro\l@advance@macro
78 \DeclareOption{symbol}{\renewcommand\thefootnote{\fnsymbol{footnote}}}
79 \newif\ifFN@robust \FN@robustfalse
80 \DeclareOption{symbol*}{%
81 \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
82 \FN@robusttrue
83 \AtEndOfPackage{\setfnsymbol{lamport*-robust}}%
84 }
85 \newif\ifFN@para \FN@parafalse
86 \DeclareOption{para}{%
87 \FN@paratrue
88 \setlength\footnotemargin{-\maxdimen} % default when para is used
89 }
90 \DeclareOption{side}{\ifFN@para
91 \PackageError{footmisc}{Option "\CurrentOption" incompatible with
92 option "para"}%
93 {I shall ignore "\CurrentOption"}%
94 \else
95 \AddToHook{fntext/para}{%
96 \hsize\marginparwidth % correct the default \hsize
97 \footnotesep\z@ % don't add a default separation
98 }
99 \AssignSocketPlug{fntext/process}{side}
100 \AssignSocketPlug{fntext/begin}{noop}
101 \AssignSocketPlug{fntext/end}{noop}
102 \fi
103 }
104 \let\footnotelayout\@empty
105 \DeclareOption{ragged}{%
106 \@ifundefined{RaggedRight}%
107 {\renewcommand\footnotelayout{\linepenalty50 \raggedright}}%
108 {\renewcommand\footnotelayout{\linepenalty50 \RaggedRight}}%
109 }
110 \newif\ifFN@perpage
111 \FN@perpagefalse
112 \DeclareOption{perpage}{%
113 \FN@perpagetrue
114 }
115 \newif\ifFN@fixskip \FN@fixskipfalse
116
117 \let\FN@bottomcases\thr@@
118 \newif\ifFN@abovefloats \FN@abovefloatstrue
119 \DeclareOption{bottom}{%
120 \let\FN@bottomcases\@ne
121 \FN@abovefloatsfalse
122 \FN@fixskiptrue
123 }
124 \DeclareOption{bottomfloats}{%
125 \let\FN@bottomcases\tw@
126 \FN@abovefloatstrue \FN@fixskiptrue
127 }
128 \DeclareOption{abovefloats}{\FN@abovefloatstrue \FN@fixskiptrue}
129 \DeclareOption{belowfloats}{\FN@abovefloatsfalse \FN@fixskiptrue}
130 \DeclareOption{marginal}{%
131 \footnotemargin-0.8em\relax
132 }
133 \DeclareOption{flushmargin}{%
134 \footnotemargin0pt\relax
135 }
136 \newif\ifFN@hangfoot \FN@hangfootfalse
137 \DeclareOption{hang}{%
138 \FN@hangfoottrue
139 }
140 \newcommand*\hangfootparskip{0.5\baselineskip}
141 \newcommand*\hangfootparindent{0em}%
142 \DeclareOption{norule}{%
143 \renewcommand\footnoterule{}%
144 \advance\skip\footins 4\p@\@plus2\p@\relax
145 }
146 \DeclareOption{splitrule}{%
147 \gdef\split@prev{0}
148 \let\pagefootnoterule\footnoterule
149 \let\mpfootnoterule\footnoterule
150 \def\splitfootnoterule{\kern-3\p@ \hrule \kern2.6\p@}
151 \def\footnoterule{\relax
152 \ifx \@listdepth\@mplistdepth
153 \mpfootnoterule
154 \else
155 \ifnum\split@prev=\z@
156 \pagefootnoterule
157 \else
158 \splitfootnoterule
159 \fi
160 \xdef\split@prev{\the\insertpenalties}%
161 \fi
162 }%
163 }
164 \newif\ifFN@stablefootnote \FN@stablefootnotefalse
165 \DeclareOption{stable}{\FN@stablefootnotetrue}
166 \newif\ifFN@multiplefootnote \FN@multiplefootnotefalse
167 \DeclareOption{multiple}{\FN@multiplefootnotetrue}
168 \ProcessOptions
169 \ifFN@para
170 \NewSocketPlug{build/column/footnotes}{para}{%
171 \global\setbox\footins\vbox{\FN@makefootnoteparagraph}%
172 }
173 \AssignSocketPlug{build/column/footnotes}{para}
174 \fi
175 \ifFN@fixskip
176 \def\@outputbox@removebskip{%
177 \ifx\@textbottom\relax \else
178 \@outputbox@append{%
179 \@tempskipa\lastskip
180 \ifnum \gluestretchorder\@tempskipa>\z@
181 \vskip-\@tempskipa
182 \xdef\@outputbox@reinsertbskip
183 {\noexpand\@outputbox@append{\vskip\the\@tempskipa}}%
184 \else
185 \global\let\@outputbox@reinsertbskip\relax
186 \fi
187 }%
188 \fi
189 }
190 \let\@outputbox@reinsertbskip\relax
191 \else
192 \let\@outputbox@removebskip \relax
193 \let\@outputbox@reinsertbskip\relax
194 \fi
195 \ifcase \FN@bottomcases\relax
196 \ERROR
197 \or %1 bottom option
198 \ifFN@abovefloats
199 \AssignSocketPlug {build/column/outputbox}{space-footnotes-floats}
200 \else
201 \AssignSocketPlug {build/column/outputbox}{floats-space-footnotes}
202 \fi
203 \or %2 bottomfloats
204 \ifFN@abovefloats
205 \AssignSocketPlug {build/column/outputbox}{footnotes-space-floats}
206 \else
207 \AssignSocketPlug {build/column/outputbox}{space-floats-footnotes}
208 \fi
209 \or %3 neither bottom nor bottomfloats
210 \ifFN@abovefloats
211 \AssignSocketPlug {build/column/outputbox}{footnotes-floats}
212 \else
213 \AssignSocketPlug {build/column/outputbox}{floats-footnotes}
214 \fi
215 \else
216 \ERROR
217 \fi
218
219 \newif\ifFN@setspace
220 \@ifpackageloaded{setspace}%
221 {%
222 \FN@setspacetrue
223 \@ifclassloaded{memoir}%
224 {%
225 \AddToHook{fntext}{\let\baselinestretch\m@m@singlespace}%
226 \let\FN@baselinestretch\m@m@singlespace
227 }%
228 {%
229 \let\FN@baselinestretch\setspace@singlespace
230 }%
231 }%
232 {%
233 \FN@setspacefalse
234 }
235
236 \ifFN@para
237
238 \AssignSocketPlug{fntext/make}{para}
239 \AssignSocketPlug{fntext/begin}{noop}
240 \AssignSocketPlug{fntext/end}{para}
241
242 \fi
243
244 \ifFN@para
245 \let\FN@tempboxa\@tempboxa
246 \newbox\FN@tempboxb
247 \newbox\FN@tempboxc
248 \newskip\footglue \footglue=1em plus.3em minus.3em
249
250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
251 \newdimen\footnotebaselineskip
252
253 % establish late:
254
255 \AddToHook{begindocument/before} {%
256 {%
257 \footnotesize
258 \global\footnotebaselineskip=\normalbaselineskip
259 }%
260 }
261
262 \long\def\FN@makefootnoteparagraph{%
263 \FN@setfootnoteparawidth
264 \@parboxrestore
265 \baselineskip=\footnotebaselineskip
266 \unvbox\footins \FN@removehboxes
267 \RawParEnd
268 }
269 \def\FN@removehboxes{\setbox\FN@tempboxa\lastbox
270 \ifhbox\FN@tempboxa{\FN@removehboxes}%
271 \unhbox\FN@tempboxa
272 \else
273 \RawNoindent
274 \rule\z@\footnotesep
275 \fi
276 }
277 \fi
278
279 \@ifpackageloaded{multicol}
280 {\def\FN@setfootnoteparawidth
281 {\hsize\ifnum\doublecol@number>\@ne
282 \textwidth
283 \else \columnwidth \fi}}
284 {\def\FN@setfootnoteparawidth{\hsize\columnwidth}}
285
286 \ifFN@perpage
287 \RequirePackage{perpage}
288 \MakePerPage{footnote}
289 \def\@stpelt#1{\global\csname c@#1\endcsname \m@ne
290 \stepcounter{#1}%
291 \pp@fix@MakePerPage{#1}%
292 }
293 \def\pp@fix@MakePerPage#1{%
294 \ifnum \value{#1}>\z@
295 \addtocounter{#1}\m@ne\fi
296 }
297 \def\pp@cl@end@iii\stepcounter#1\pp@fix@MakePerPage#2{}
298 \fi
299
300 \ifFN@para
301
302
303
304 \AddToHook{fntext/begin}{\nobreak \hspace{.2em}}
305
306 \else
307
308 \ifFN@hangfoot
309 \long\def\footmisc@hang@makefntext#1{%
310 \bgroup
311 \SuspendTagging{footmisc}%
312 \setbox\@tempboxa\hbox{%
313 \ifdim\footnotemargin>\z@
314 \hb@xt@\footnotemargin{\@makefnmark\hss}%
315 \else
316 \@makefnmark
317 \fi
318 }%
319 \leftmargin\wd\@tempboxa
320 \rightmargin\z@
321 \linewidth \columnwidth
322 \advance \linewidth -\leftmargin
323 \parshape \@ne \leftmargin \linewidth
324 \footnotesize
325 \parskip\hangfootparskip\relax
326 \parindent\hangfootparindent\relax
327 \@setpar{{\@@par}}%
328 \ResumeTagging{footmisc}%
329 \leavevmode
330 \UseSocket{fntext/mark/link}%
331 \UseTaggingSocket{fntext/mark}{}%
332 {\llap{%
333 \ifdim\footnotemargin>\z@
334 \hb@xt@\footnotemargin{\@makefnmark\hss}%
335 \else
336 \@makefnmark
337 \fi
338 }}%
339 \footnotelayout#1%
340 \par
341 \egroup
342 }
343 \let \@makefntext \footmisc@hang@makefntext
344
345 \else
346
347
348 \fi
349 \fi
350
351 \ifFN@multiplefootnote
352 \providecommand*{\multiplefootnotemarker}{3sp}
353 \ExplSyntaxOn
354 \providecommand*{\multfootsep}{\tag_mc_end_push:\tag_mc_begin:n{artifact},\tag_mc_end:\tag_mc_begin_pop:n{}}
355 \ExplSyntaxOff
356 \AddToHook{fnmark} {\FN@mf@check}
357 \AddToHook{fnmark/end} {\FN@mf@prepare}
358 \def\FN@mf@prepare{%
359 \kern-\multiplefootnotemarker
360 \kern\multiplefootnotemarker\relax
361 }
362 \def\FN@mf@check{%
363 \ifdim\lastkern=\multiplefootnotemarker\relax
364 \edef\@x@sf{\the\spacefactor}%
365 \unkern % new
366 \unkern
367 \textsuperscript{\multfootsep}%
368 \spacefactor\@x@sf\relax
369 \fi
370 }
371 \else
372 \let\FN@mf@prepare\relax
373 \fi
374 \ifFN@stablefootnote
375 \let\FN@sf@@footnote\footnote
376 \def\footnote{\ifx\protect\@typeset@protect
377 \expandafter\FN@sf@@footnote
378 \else
379 \expandafter\FN@sf@gobble@opt
380 \fi
381 }
382 \edef\FN@sf@gobble@opt{\noexpand\protect
383 \expandafter\noexpand\csname FN@sf@gobble@opt \endcsname}
384 \expandafter\def\csname FN@sf@gobble@opt \endcsname{%
385 \@ifnextchar[%]
386 \FN@sf@gobble@twobracket
387 \@gobble
388 }
389 \def\FN@sf@gobble@twobracket[#1]#2{}
390 \let\FN@sf@@footnotemark\footnotemark
391 \def\footnotemark{\ifx\protect\@typeset@protect
392 \expandafter\FN@sf@@footnotemark
393 \else
394 \expandafter\FN@sf@gobble@optonly
395 \fi
396 }
397 \edef\FN@sf@gobble@optonly{\noexpand\protect
398 \expandafter\noexpand\csname FN@sf@gobble@optonly \endcsname}
399 \expandafter\def\csname FN@sf@gobble@optonly \endcsname{%
400 \@ifnextchar[%]
401 \FN@sf@gobble@bracket
402 {}%
403 }
404 \def\FN@sf@gobble@bracket[#1]{}
405 \fi
406 \newcommand\setfnsymbol[1]{%
407 \@bsphack
408 \@ifundefined{FN@fnsymbol@#1}%
409 {%
410 \PackageError{footmisc}{Symbol style "#1" not known}%
411 \@eha
412 }{%
413 \expandafter\let\expandafter\@fnsymbol\csname
414 FN@fnsymbol@#1\endcsname
415 }%
416 \@esphack
417 }
418 \let\FN@fnsymbol@lamport\@fnsymbol
419 \newif\if@tempswb
420 \DeclareDocumentCommand\DefineFNsymbols {smO{text}m}{%
421 \expandafter\ifx\csname FN@fnsymbol@#2\endcsname\relax
422 \PackageInfo{footmisc}{Declaring symbol style #2}%
423 \else
424 \PackageWarning{footmisc}{Redeclaring symbol style #2}%
425 \fi
426 \toks@{}%
427 \def\@tempb{\end}%
428 \FN@build@symboldef#4\end
429 \def\@tempc{math}%
430 \def\@tempd{#3}%
431 \expandafter\xdef\csname FN@fnsymbol@#2\endcsname##1{%
432 \ifx\@tempc\@tempd
433 \noexpand\ensuremath
434 \else
435 \noexpand\nfss@text
436 \fi
437 {%
438 \noexpand\ifcase##1%
439 \the\toks@
440 \noexpand\else
441 \IfBooleanTF#1{\noexpand\@ctrerr}%
442 {\noexpand\FN@orange##1}%
443 \noexpand\fi
444 }%
445 }%
446 }
447 \def\FN@build@symboldef#1{%
448 \def\@tempa{#1}%
449 \ifx\@tempa\@tempb
450 \else
451 \toks@\expandafter{\the\toks@\or#1}%
452 \expandafter\FN@build@symboldef
453 \fi
454 }
455 \DeclareDocumentCommand\DefineFNsymbolsTM {smm}{%
456 \expandafter\ifx\csname FN@fnsymbol@#2\endcsname\relax
457 \PackageInfo{footmisc}{Declaring symbol style #2}%
458 \else
459 \PackageWarning{footmisc}{Redeclaring symbol style #2}%
460 \fi
461 \toks@{}%
462 \def\@tempb{\end}%
463 \FN@build@symboldefTM#3\end\@null
464 \expandafter\xdef\csname FN@fnsymbol@#2\endcsname##1{%
465 \noexpand\ifcase##1%
466 \the\toks@
467 \noexpand\else
468 \IfBooleanTF#1{\noexpand\@ctrerr}%
469 {\noexpand\FN@orange##1}%
470 \noexpand\fi
471 }%
472 }
473 \def\FN@build@symboldefTM#1#2{%
474 \def\@tempa{#1}%
475 \ifx\@tempa\@tempb
476 \else
477 \toks@\expandafter{\the\toks@\or\TextOrMath{#1}{#2}}%
478 \expandafter\FN@build@symboldefTM
479 \fi
480 }
481 \def\FN@orange#1{%
482 \ifFN@robust
483 \@arabic#1%
484 \@bsphack
485 \PackageInfo{footmisc}{Footnote number \number#1 out of range}%
486 \protect\@fnsymbol@orange
487 \@esphack
488 \else \@ctrerr \fi
489 }
490 \global\let\@diagnose@fnsymbol@orange\relax
491 \AtEndDocument{\@diagnose@fnsymbol@orange}
492 \def\@fnsymbol@orange{%
493 \gdef\@diagnose@fnsymbol@orange{%
494 \PackageWarningNoLine{footmisc}{Some footnote number(s)
495 were out of range
496 \MessageBreak
497 see log for details%
498 }%
499 }%
500 }
501 \DefineFNsymbolsTM{bringhurst}{%
502 \textasteriskcentered *%
503 \textdagger \dagger
504 \textdaggerdbl \ddagger
505 \textsection \mathsection
506 \textbardbl \|%
507 \textparagraph \mathparagraph
508 }%
509 \DefineFNsymbolsTM{chicago}{%
510 \textasteriskcentered *%
511 \textdagger \dagger
512 \textdaggerdbl \ddagger
513 \textsection \mathsection
514 \textbardbl \|%
515 \#\#%
516 }%
517 \DefineFNsymbolsTM{wiley}{%
518 \textasteriskcentered *%
519 {\textasteriskcentered\textasteriskcentered}{**}%
520 \textdagger \dagger
521 \textdaggerdbl \ddagger
522 \textsection \mathsection
523 \textparagraph \mathparagraph
524 \textbardbl \|%
525 }%
526 \DefineFNsymbolsTM{lamport-robust}{%
527 \textasteriskcentered *%
528 \textdagger \dagger
529 \textdaggerdbl \ddagger
530 \textsection \mathsection
531 \textparagraph \mathparagraph
532 \textbardbl \|%
533 {\textasteriskcentered\textasteriskcentered}{**}%
534 {\textdagger\textdagger}{\dagger\dagger}%
535 {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
536 }
537 \DefineFNsymbolsTM*{lamport*}{%
538 \textasteriskcentered *%
539 \textdagger \dagger
540 \textdaggerdbl \ddagger
541 \textsection \mathsection
542 \textparagraph \mathparagraph
543 \textbardbl \|%
544 {\textasteriskcentered\textasteriskcentered}{**}%
545 {\textdagger\textdagger}{\dagger\dagger}%
546 {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
547 {\textsection\textsection}{\mathsection\mathsection}%
548 {\textparagraph\textparagraph}{\mathparagraph\mathparagraph}%
549 {\textasteriskcentered\textasteriskcentered\textasteriskcentered}{***}%
550 {\textdagger\textdagger\textdagger}{\dagger\dagger\dagger}%
551 {\textdaggerdbl\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger\ddagger}%
552 {\textsection\textsection\textsection}%%
553 {\mathsection\mathsection\mathsection}%
554 {\textparagraph\textparagraph\textparagraph}%%
555 {\mathparagraph\mathparagraph\mathparagraph}%
556 }
557 \setfnsymbol{lamport*}
558 \DefineFNsymbolsTM{lamport*-robust}{%
559 \textasteriskcentered *%
560 \textdagger \dagger
561 \textdaggerdbl \ddagger
562 \textsection \mathsection
563 \textparagraph \mathparagraph
564 \textbardbl \|%
565 {\textasteriskcentered\textasteriskcentered}{**}%
566 {\textdagger\textdagger}{\dagger\dagger}%
567 {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
568 {\textsection\textsection}{\mathsection\mathsection}%
569 {\textparagraph\textparagraph}{\mathparagraph\mathparagraph}%
570 {\textasteriskcentered\textasteriskcentered\textasteriskcentered}{***}%
571 {\textdagger\textdagger\textdagger}{\dagger\dagger\dagger}%
572 {\textdaggerdbl\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger\ddagger}%
573 {\textsection\textsection\textsection}%%
574 {\mathsection\mathsection\mathsection}%
575 {\textparagraph\textparagraph\textparagraph}%%
576 {\mathparagraph\mathparagraph\mathparagraph}%
577 }
578 \newcommand\mpfootnotemark{%
579 \@ifnextchar[%]
580 \@xmpfootnotemark
581 {%
582 \stepcounter\@mpfn
583 \protected@xdef\@thefnmark{\thempfn}%
584 \@footnotemark
585 }%
586 }
587 \def\@xmpfootnotemark[#1]{%
588 \begingroup
589 \csname c@\@mpfn\endcsname #1\relax
590 \unrestored@protected@xdef\@thefnmark{\thempfn}%
591 \endgroup
592 \@footnotemark
593 }
594 \endinput
595 %%
596 %% End of file `latex-lab-footmisc.ltx'.