Debian Codegraph @

texmf-dist/source/latex/base/ltfloat.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX Project and any individual authors listed elsewhere
5 % in this file.
6 %
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9 %
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 or later.
17 %
18 % This file has the LPPL maintenance status "maintained".
19 %
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23 %
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
27 %
28 % \fi
29 % \iffalse
30 %%% From File: ltfloat.dtx
31 %
32 %<*driver>
33 % \fi
34 \ProvidesFile{ltfloat.dtx}[2024/04/22 v1.2g LaTeX Kernel (Floats)]
35 % \iffalse
36 \documentclass{ltxdoc}
37 \GetFileInfo{ltfloat.dtx}
38 \title{\filename}
39 \date{\filedate}
40 \author{%
41 Johannes Braams\and
42 David Carlisle\and
43 Alan Jeffrey\and
44 Leslie Lamport\and
45 Frank Mittelbach\and
46 Chris Rowley\and
47 Rainer Sch\"opf}
48
49 \begin{document}
50 \MaintainedByLaTeXTeam{latex}
51 \maketitle
52 \DocInput{\filename}
53 \end{document}
54 %</driver>
55 % \fi
56 %
57 %
58 % \section{Floats}
59 %
60 % The different types of floats are identified by a \meta{type} name,
61 % which is the name of the counter for that kind of float. For
62 % example, figures are of type `figure' and tables are of type `table'.
63 % Each \meta{type} has associated a positive \meta{type number}, which
64 % is a power of two. E.g.,\\
65 % figures might be have type number~1, tables type number~2, programs
66 % type number~4, etc.
67 %
68 % The locations where a float can go are specified by a
69 % \meta{placement specifier}, which is a list of the possible
70 % locations, each denoted by a letter as follows:
71 % \begin{center}
72 % \begin{tabular}{l@{ : }l@{ --- }l}
73 % h & here & at the current location in the text.\\
74 % t & top & at the top of a text page.\\
75 % b & bottom & at the bottom of a text page.\\
76 % p & page & on a separate float page
77 % \end{tabular}
78 % \end{center}
79 % In addition, in conjunction with these, you can use `!' which means
80 % that the current values of the float positioning parameters are
81 % ignored for this float. (Has no effect on `p', float page
82 % positioning.)
83 % For example, `pht' specifies that the float can appear in any of
84 % three locations: page, here or top.
85 %
86 % \MaybeStop{}
87 %
88 %
89 % \changes{v1.0a}{1994/03/04}{Initial version, split from latex.dtx}
90 % \changes{v1.0b}{1994/03/28}{Split further from ltherest.dtx}
91 % \changes{v1.0e}{1994/04/25}{Changed warning messages}
92 % \changes{v1.0e}{1994/04/25}{Removed obsolete tracing code}
93 % \changes{v1.0f}{1994/05/03}
94 % {(CAR) Added \cs{@largefloatcheck}}
95 % \changes{v1.0f}{1994/05/03}{Removed unnecessary braces from
96 % arguments of \cs{@ifnextchar}}
97 % \changes{v1.0i}{1994/05/22}{Use new warning commands}
98 % \changes{v1.1e}{1994/11/17}
99 % {\cs{@tempa} to \cs{reserved@a}}
100 % \changes{v1.1g}{1994/12/10}{Some temps reinserted temporarily}
101 % \changes{v1.1n}{1995/11/28}{documentation fixes}
102 % \changes{v1.1s}{1997/06/16}{documentation fixes}
103 %
104 % \subsection{Floating Environments}
105 % \begin{macrocode}
106 %<*2ekernel>
107 \message{floats,}
108 % \end{macrocode}
109 % \begin{oldcomments}
110 %
111 % Where floats may appear on a page, and how many may appear there
112 % are specified by the following float placement parameters. The
113 % numbers are named like counters so the user can set them with
114 % the ordinary counter-setting commands.
115 %
116 % \c@topnumber : Number of floats allowed at the top of a column.
117 % \topfraction : Fraction of column that can be devoted to floats.
118 % \c@dbltopnumber, \dbltopfraction
119 % : Same as above, but for double-column floats.
120 % \c@bottomnumber, \bottomfraction
121 % : Same as above for bottom of page.
122 % \c@totalnumber : Number of floats allowed in a single column,
123 % including in-text floats.
124 % \textfraction :Minimum fraction of column that must contain text.
125 % \floatpagefraction: Minimum fraction of page that must be taken
126 % up by float page.
127 % \dblfloatpagefraction
128 % : Same as above, for double-column floats.
129 %
130 % The document style must define the following.
131 %
132 % \fps@TYPE : The default placement specifier for floats of type
133 % TYPE.
134 %
135 % \ftype@TYPE : The type number for floats of type TYPE.
136 %
137 % \ext@TYPE : The file extension indicating the file on which the
138 % contents list for float type TYPE is stored.
139 % For example, \ext@figure = 'lof'.
140 %
141 % \fnum@TYPE : A macro to generate the figure number for a caption.
142 % For example, \fnum@TYPE == Figure \thefigure.
143 %
144 % \@makecaption{NUM}{TEXT} :
145 % A macro to make a caption, with NUM the value
146 % produced by \fnum@... and TEXT the text of the caption.
147 % It can assume it's in a \parbox of the appropriate width.
148 %
149 % \@float{TYPE}[PLACEMENT] : This macro begins a float environment for a
150 % single-column float of type TYPE with PLACEMENT as the placement
151 % specifier. The default value of PLACEMENT is defined by
152 % \fps@TYPE. The environment is ended by \end@float.
153 % E.g., \figure == \@float{figure}, \endfigure == \end@float.
154 %
155 % \@float{TYPE}[PLACEMENT] ==
156 % BEGIN
157 % if hmode then \@bsphack
158 % \@floatpenalty := -10002
159 % else \@floatpenalty := -10003
160 % fi
161 % \@captype ==L TYPE
162 % \@dblflset
163 % \@fps ==L PLACEMENT
164 % \@onelevel@sanitize \@fps
165 % add default PLACEMENT if at most ! in PLACEMENT == \@fpsadddefault
166 % if inner
167 % then LaTeX Error: 'Not in outer paragraph mode.'
168 % \@floatpenalty := 0
169 % else if \@freelist nonempty
170 % then \@currbox :=L head of \@freelist
171 % \@freelist :=G tail of \@freelist
172 % \count\@currbox :=G 32*\ftype@TYPE +
173 % bits determined by PLACEMENT
174 % else \@floatpenalty := 0
175 % LaTeX Error: 'Too many unprocessed floats'
176 % fi
177 % fi
178 % \@currbox :=G \color@vbox
179 % \normalcolor
180 % \vbox{
181 % %% 15 Dec 87 --
182 % %% removed \boxmaxdepth :=L 0pt
183 % %% that made box 0 depth because it screwed
184 % %% things up. Instead, added \vskip0pt at end
185 % \hsize = \columnwidth
186 % \@parboxrestore
187 % \@floatboxreset
188 % END
189 %
190 % \caption ==
191 % BEGIN
192 % \refstepcounter{\@captype}
193 % \@dblarg{\@caption{\@captype}}
194 % END
195 %
196 % In following definition, \par moved from after \addcontentsline to
197 % before \addcontentsline because the \write could cause
198 % an extra blank line to be added to the paragraph above the
199 % caption. (Change made 12 Jun 87)
200 %
201 % \@caption{TYPE}[STEXT]{TEXT} ==
202 % BEGIN
203 % \par
204 % \addcontentsline{\ext@TYPE}{TYPE}{\numberline{\theTYPE}{STEXT}}
205 % \begingroup
206 % \@parboxrestore
207 % \@normalsize
208 % \@makecaption{\fnum@TYPE}{TEXT}
209 % \par
210 % \endgroup
211 % END
212 %
213 %
214 % \@dblfloat{TYPE}[PLACEMENT] : Macro to begin a float environment for
215 % a double-column float of type TYPE with PLACEMENT as the placement
216 % specifier. The default value of PLACEMENT is 'tp'
217 % The environment is ended by \end@dblfloat.
218 % E.g., \figure* == \@dblfloat{figure},
219 % \endfigure* == \end@dblfloat.
220 %
221 % \@dblfloat{TYPE}[PLACEMENT] ==
222 % Identical to \@float{TYPE}[PLACEMENT] except \hsize and \linewidth
223 % are set to \textwidth.
224 % \end{oldcomments}
225 %
226 % \begin{macro}{\@floatpenalty}
227 % \begin{macrocode}
228 \newcount\@floatpenalty
229 % \end{macrocode}
230 % \end{macro}
231 %
232 % \begin{macro}{\caption}
233 %
234 % This is set to be an error message outside a float since no
235 % captype is defined there; this may need to be changed by some
236 % classes.
237 % \changes{v1.1u}{1999/04/19}
238 % {Made caption an error outside a float: latex/2815}
239 % \begin{macrocode}
240 \def\caption{%
241 \ifx\@captype\@undefined
242 \@latex@error{\noexpand\caption outside float}\@ehd
243 \expandafter\@gobble
244 \else
245 \refstepcounter\@captype
246 \expandafter\@firstofone
247 \fi
248 {\@dblarg{\@caption\@captype}}%
249 }
250 % \end{macrocode}
251 % \end{macro}
252 %
253 % \begin{macro}{\@caption}
254 % \changes{v1.0b}{1994/03/28}
255 % {Use \cs{normalsize} not \cs{@normalsize}}
256 % \changes{v1.1r}{1996/12/06}
257 % {Call \cs{@setminpage} if needed. latex/2318}
258 % \begin{macrocode}
259 \long\def\@caption#1[#2]#3{%
260 \par
261 \addcontentsline{\csname ext@#1\endcsname}{#1}%
262 {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
263 \begingroup
264 % \end{macrocode}
265 %
266 % The paragraph setting parameters are normalised at this point, however
267 % |\@parboxrestore| resets |\everypar| which is not correct in this
268 % context so |\@setminipage| is called if needed.
269 %
270 % The float mechanism, like minipage, sets the flag |@minipage| true
271 % before executing the user-supplied text. Many \LaTeX\ constructs
272 % test for this flag and do not add vertical space when it is true.
273 % The intention is that this emulates \TeX's `top of page' behaviour.
274 % The flag must be set false at the start of the first paragraph. This
275 % is achieved by a redefinition of |\everypar|, but the call to
276 % |\@parboxrestore| removes that redefinition, so it is re-inserted
277 % if needed. If the flag is already false then the |\caption| was not
278 % the first entry in the float, and so some other paragraph has already
279 % activated the special |\everypar|. In this case no further action is
280 % needed.
281 % \begin{macrocode}
282 \@parboxrestore
283 \if@minipage
284 \@setminipage
285 \fi
286 % \end{macrocode}
287 %
288 % \begin{macrocode}
289 \normalsize
290 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
291 \endgroup}
292 % \end{macrocode}
293 % \end{macro}
294 %
295 % \begin{macro}{\@float}
296 % \begin{macro}{\@dblflset}
297 % \changes{v1.1a}{1994/10/31}{Macro added}
298 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
299 % \changes{v1.1a}{1994/10/31}
300 % {Major changes to parameter parsing, setting of local variables,
301 % etc; two-column and one-column cases merged; space hacks moved}
302 % \changes{v1.1c}{1994/11/05}
303 % {Add compatibility with old version of \cs{@xfloat}.}
304 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
305 %
306 % \begin{macrocode}
307 \def\@float#1{%
308 \@ifnextchar[%
309 {\@xfloat{#1}}%
310 {\edef\reserved@a{\noexpand\@xfloat{#1}[\csname fps@#1\endcsname]}%
311 \reserved@a}}
312 % \end{macrocode}
313 %
314 % \end{macro}
315 % \end{macro}
316 %
317 % \begin{macro}{\@dblfloat}
318 % \changes{v1.1a}{1994/10/31}
319 % {Major changes since two-column and one-column cases merged}
320 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
321 %
322 % \begin{macrocode}
323 \def\@dblfloat{%
324 \if@twocolumn\let\reserved@a\@dbflt\else\let\reserved@a\@float\fi
325 \reserved@a}
326 % \end{macrocode}
327 % \end{macro}
328 %
329 %
330 % \begin{macro}{\fps@dbl}
331 % \changes{v1.1a}{1994/10/31}{Macro added}
332 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
333 % Note that all double floats have default fps `tp'.
334 % \end{macro}
335 %
336 % \begin{macro}{\@setfps}
337 % \changes{v1.1a}{1994/10/31}{Macro added}
338 % \changes{v1.1c}{1994/11/05}
339 % {Add compatibility with old version of \cs{@xfloat}.}
340 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
341 % This sets the fps, dealing with error conditions by adding
342 % the default.
343 %
344 % \end{macro}
345 %
346 % \begin{macro}{\@xfloat}
347 % \changes{LaTeX2e}{1993/12/05}{Command changed}
348 % \changes{LaTeX2e}{1994/01/21}{Added missing percent characters.}
349 % \changes{v1.1a}{1994/10/31}
350 % {Major changes, removing setting of local variables, space hacks
351 % etc; two-column and one-column cases merged}
352 % \changes{v1.1c}{1994/11/05}
353 % {Add compatibility with old version of \cs{@xfloat}: but the
354 % arguments, provided at exorbitant cost, are now completely
355 % ignored}
356 % \changes{v1.1f}{1994/11/21}
357 % {Missing percents reinserted after 4, 8: these are not numbers.}
358 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
359 % \changes{v1.1g}{1994/12/10}{Sanitization added temporarily}
360 % The first part of this sets the count register that stores all
361 % the information about the type and fps of the float.
362 %
363 % We assume here that the default specifiers already contain no
364 % active characters.
365 %
366 % It may be better to store the defaults as numbers, rather than
367 % symbol strings.
368 %
369 % \changes{v1.1p}{1996/10/24}{Added \cs{@nodocument} to trap
370 % floats in the preamble}
371 % \begin{macrocode}
372 %</2ekernel>
373 %<latexrelease>\IncludeInRelease{2015/01/01}%
374 %<latexrelease> {\@xfloat}{Check float options}%
375 %<*2ekernel|latexrelease>
376 \def\@xfloat #1[#2]{%
377 \@nodocument
378 \def \@captype {#1}%
379 \def \@fps {#2}%
380 \@onelevel@sanitize \@fps
381 \def \reserved@b {!}%
382 \ifx \reserved@b \@fps
383 \@fpsadddefault
384 \else
385 \ifx \@fps \@empty
386 \@fpsadddefault
387 \fi
388 \fi
389 \ifhmode
390 \@bsphack
391 \@floatpenalty -\@Mii
392 \else
393 \@floatpenalty-\@Miii
394 \fi
395 \ifinner
396 \@parmoderr\@floatpenalty\z@
397 \else
398 \@next\@currbox\@freelist
399 {%
400 \@tempcnta \sixt@@n
401 \expandafter \@tfor \expandafter \reserved@a
402 \expandafter :\expandafter =\@fps
403 \do
404 % \end{macrocode}
405 % \changes{v1.2b}{2015/01/11}{Check for valid option (latexrelease)}
406 % Start of changes, use a nested if structure, ending in an error.
407 % \begin{macrocode}
408 {%
409 \if \reserved@a h%
410 \ifodd \@tempcnta
411 \else
412 \advance \@tempcnta \@ne
413 \fi
414 \else\if \reserved@a t%
415 \@setfpsbit \tw@
416 \else\if \reserved@a b%
417 \@setfpsbit 4%
418 \else\if \reserved@a p%
419 \@setfpsbit 8%
420 \else\if \reserved@a !%
421 \ifnum \@tempcnta>15
422 \advance\@tempcnta -\sixt@@n\relax
423 \fi
424 \else
425 \@latex@error{Unknown float option `\reserved@a'}%
426 {Option `\reserved@a' ignored and `p' used.}%
427 \@setfpsbit 8%
428 \fi\fi\fi\fi\fi
429 }%
430 % \end{macrocode}
431 % End of changes
432 % \begin{macrocode}
433 \@tempcntb \csname ftype@\@captype \endcsname
434 \multiply \@tempcntb \@xxxii
435 \advance \@tempcnta \@tempcntb
436 \global \count\@currbox \@tempcnta
437 }%
438 \@fltovf
439 \fi
440 % \end{macrocode}
441 % The remainder sets up the box in which the float is typeset, and
442 % the typesetting environment to be used. It is essential to have
443 % the extra box to avoid the unwanted space that would otherwise
444 % often be put at the top of the float.
445 %
446 % It ends with a hook; not sure how useful this is but it is needed
447 % at present to deal with double-column floats.
448 % \task{CAR?}{Sort out hooks}
449 % \changes{v1.0a}{1994/03/07}
450 % {(DPC) Extra group for colour}
451 % \changes{v1.0c}{1994/03/14}
452 % {(DPC) Use \cs{color@begingroup}}
453 % \changes{v1.0g}{1994/05/13}
454 % {(DPC) Use \cs{normalcolor}}
455 % \changes{v1.1a}{1994/10/31}
456 % {(DPC/CAR) Extra box added to remove colour resetting from vmode}
457 % \changes{v1.1a}{1994/10/31}{Reset hook added}
458 % \changes{v1.1c}{1994/11/05}
459 % {Use new \cs{color@hbox} concept.}
460 % \changes{v1.1f}{1994/11/21}
461 % {Changed to \cs{color@vbox} so that large floats overflow
462 % at the bottom}
463 % \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak}}
464 % \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage}}
465 % \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
466 % \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
467 % \begin{macrocode}
468 \global \setbox\@currbox
469 \color@vbox
470 \normalcolor
471 \vbox \bgroup
472 \hsize\columnwidth
473 \@parboxrestore
474 \@floatboxreset
475 }%
476 %</2ekernel|latexrelease>
477 %<latexrelease>\EndIncludeInRelease
478 %<latexrelease>\IncludeInRelease{0000/00/00}%
479 %<latexrelease> {\@xfloat}{Check float options}%
480 %<latexrelease>\def\@xfloat #1[#2]{%
481 %<latexrelease> \@nodocument
482 %<latexrelease> \def \@captype {#1}%
483 %<latexrelease> \def \@fps {#2}%
484 %<latexrelease> \@onelevel@sanitize \@fps
485 %<latexrelease> \def \reserved@b {!}%
486 %<latexrelease> \ifx \reserved@b \@fps
487 %<latexrelease> \@fpsadddefault
488 %<latexrelease> \else
489 %<latexrelease> \ifx \@fps \@empty
490 %<latexrelease> \@fpsadddefault
491 %<latexrelease> \fi
492 %<latexrelease> \fi
493 %<latexrelease> \ifhmode
494 %<latexrelease> \@bsphack
495 %<latexrelease> \@floatpenalty -\@Mii
496 %<latexrelease> \else
497 %<latexrelease> \@floatpenalty-\@Miii
498 %<latexrelease> \fi
499 %<latexrelease> \ifinner
500 %<latexrelease> \@parmoderr\@floatpenalty\z@
501 %<latexrelease> \else
502 %<latexrelease> \@next\@currbox\@freelist
503 %<latexrelease> {%
504 %<latexrelease> \@tempcnta \sixt@@n
505 %<latexrelease> \expandafter \@tfor \expandafter \reserved@a
506 %<latexrelease> \expandafter :\expandafter =\@fps
507 %<latexrelease> \do
508 %<latexrelease> {%
509 %<latexrelease> \if \reserved@a h%
510 %<latexrelease> \ifodd \@tempcnta
511 %<latexrelease> \else
512 %<latexrelease> \advance \@tempcnta \@ne
513 %<latexrelease> \fi
514 %<latexrelease> \fi
515 %<latexrelease> \if \reserved@a t%
516 %<latexrelease> \@setfpsbit \tw@
517 %<latexrelease> \fi
518 %<latexrelease> \if \reserved@a b%
519 %<latexrelease> \@setfpsbit 4%
520 %<latexrelease> \fi
521 %<latexrelease> \if \reserved@a p%
522 %<latexrelease> \@setfpsbit 8%
523 %<latexrelease> \fi
524 %<latexrelease> \if \reserved@a !%
525 %<latexrelease> \ifnum \@tempcnta>15
526 %<latexrelease> \advance\@tempcnta -\sixt@@n\relax
527 %<latexrelease> \fi
528 %<latexrelease> \fi
529 %<latexrelease> }%
530 %<latexrelease> \@tempcntb \csname ftype@\@captype \endcsname
531 %<latexrelease> \multiply \@tempcntb \@xxxii
532 %<latexrelease> \advance \@tempcnta \@tempcntb
533 %<latexrelease> \global \count\@currbox \@tempcnta
534 %<latexrelease> }%
535 %<latexrelease> \@fltovf
536 %<latexrelease> \fi
537 %<latexrelease> \global \setbox\@currbox
538 %<latexrelease> \color@vbox
539 %<latexrelease> \normalcolor
540 %<latexrelease> \vbox \bgroup
541 %<latexrelease> \hsize\columnwidth
542 %<latexrelease> \@parboxrestore
543 %<latexrelease> \@floatboxreset
544 %<latexrelease>}%
545 %<latexrelease>\EndIncludeInRelease
546 %<*2ekernel>
547 % \end{macrocode}
548 % \end{macro}
549 %
550 % \begin{macro}{\@floatboxreset}
551 % \changes{v1.1a}{1994/10/31}{Macro added}
552 %
553 % The rational for allowing these normally global flags to be set
554 % locally here, via |\@parboxrestore|, was stated originally by
555 % Donald Arseneau and extended by Chris Rowley.
556 % It is because these flags are only set globally to
557 % true by section commands, and these should never appear within
558 % marginals or floats or, indeed, in any group; and they are only ever
559 % set globally to false when they are definitely true.
560 %
561 % If anyone is unhappy with this argument then both flags should be
562 % treated as in |\@setnobreak|; otherwise this command will be
563 % redundant.
564 % \changes{v1.1p}{1996/10/24}
565 % {Added local settings of flags: dangerous!!}
566 % \begin{macrocode}
567 \def \@floatboxreset {%
568 \reset@font
569 \normalsize
570 \@setminipage
571 }
572 % \end{macrocode}
573 % \end{macro}
574 %
575 % \begin{macro}{\@setnobreak}
576 % \changes{v1.1f}{1994/11/21}{Macro added}
577 % \changes{v1.1n}{1996/07/26}{remove unnecessary \cs{global} before
578 % \cs{@nobreak...}}
579 % \begin{macrocode}
580 \def \@setnobreak{%
581 \if@nobreak
582 \let\outer@nobreak\@nobreaktrue
583 \@nobreakfalse
584 \fi
585 }
586 % \end{macrocode}
587 % \end{macro}
588 %
589 % \begin{macro}{\@setminipage}
590 % \changes{v1.1f}{1994/11/21}{Macro added}
591 % \changes{v1.1n}{1996/07/26}{remove unnecessary \cs{global} before
592 % \cs{@minipage...}}
593 % \begin{macrocode}
594 \def \@setminipage{%
595 \@minipagetrue
596 \everypar{\@minipagefalse\everypar{}}%
597 }
598 % \end{macrocode}
599 % \end{macro}
600 %
601 % \begin{macro}{\end@float}
602 % \changes{v1.0f}{1994/05/03}
603 % {(CAR) Added \cs{@largefloatcheck}}
604 % \changes{v1.1n}{1995/10/25}{(CAR) unify code for double and
605 % single versions}
606 % \begin{macrocode}
607 \def\end@float{%
608 \@endfloatbox
609 \ifnum\@floatpenalty <\z@
610 % \end{macrocode}
611 % We make sure that we never exceed |\textheight|, otherwise float
612 % will never get typeset (91/03/15 FMi).
613 % \begin{macrocode}
614 \@largefloatcheck
615 \@cons\@currlist\@currbox
616 \ifnum\@floatpenalty <-\@Mii
617 \penalty -\@Miv
618 % \end{macrocode}
619 % Saving and restoring |\prevdepth| added 26 May 87 to prevent extra
620 % vertical space when used in vertical mode.
621 % \begin{macrocode}
622 \@tempdima\prevdepth
623 \vbox{}%
624 \prevdepth\@tempdima
625 % \end{macrocode}
626 %
627 % \begin{macrocode}
628 \penalty\@floatpenalty
629 % \end{macrocode}
630 % \changes{LaTeX2.09}{1992/03/18}
631 % {(RmS) changed \cs{@esphack} to \cs{@Esphack}}
632 % \begin{macrocode}
633 \else
634 \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack
635 \fi
636 \fi
637 }
638 % \end{macrocode}
639 % \end{macro}
640 %
641 % \begin{macro}{\end@dblfloat}
642 % \changes{v1.0f}{1994/05/03}{\cs{@largefloatcheck} added}
643 % \changes{v1.1n}{1995/10/25}{(CAR) unify code for double and
644 % single versions}
645 % \changes{v1.2b}{2015/01/11}{float order in 2-column (latexrelease)}
646 % \begin{macrocode}
647 %</2ekernel>
648 %<latexrelease>\IncludeInRelease{2015/01/01}%
649 %<latexrelease> {\end@dblfloat}{float order in 2-column}%
650 %<*2ekernel|latexrelease>
651 \def\end@dblfloat{%
652 \if@twocolumn
653 \@endfloatbox
654 \ifnum\@floatpenalty <\z@
655 \@largefloatcheck
656 % \end{macrocode}
657 %
658 % Force the depth of two column float boxes.
659 % \begin{macrocode}
660 \global\dp\@currbox1sp %
661 % \end{macrocode}
662 % What follows is essentially |\end@float| without a starting
663 % |\@endfloatbox|.
664 % \changes{v1.2b}{2000/09/24}{FMi: use output routine to
665 % defer float}
666 % \changes{v1.2b}{2014/04/27}{Inline the code to allow some
667 % coexistence with packages that hook into \cs{end@float} and do not
668 % know about the algorithm change}
669 % \begin{macrocode}
670 \@cons\@currlist\@currbox
671 \ifnum\@floatpenalty <-\@Mii
672 \penalty -\@Miv
673 \@tempdima\prevdepth
674 \vbox{}%
675 \prevdepth\@tempdima
676 \penalty\@floatpenalty
677 \else
678 \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack
679 \fi
680 % \end{macrocode}
681 % \changes{v1.2b}{2014/06/10}{missing \cs{fi} added}
682 % \begin{macrocode}
683 \fi
684 \else
685 \end@float
686 \fi
687 }%
688 %</2ekernel|latexrelease>
689 %<latexrelease>\EndIncludeInRelease
690 %<latexrelease>\IncludeInRelease{0000/00/00}%
691 %<latexrelease> {\end@dblfloat}{float order in 2-column}%
692 %<latexrelease>\def\end@dblfloat{%
693 %<latexrelease>\if@twocolumn
694 %<latexrelease> \@endfloatbox
695 %<latexrelease> \ifnum\@floatpenalty <\z@
696 % \end{macrocode}
697 % We make sure that we never exceed |\textheight|, otherwise float
698 % will never get typeset (91/03/15 FMi).
699 % \begin{macrocode}
700 %<latexrelease> \@largefloatcheck
701 %<latexrelease> \@cons\@dbldeferlist\@currbox
702 %<latexrelease> \fi
703 % \end{macrocode}
704 % RmS 92/03/18 changed |\@esphack| to |\@Esphack|.
705 % \begin{macrocode}
706 %<latexrelease> \ifnum \@floatpenalty =-\@Mii \@Esphack\fi
707 %<latexrelease>\else
708 %<latexrelease> \end@float
709 %<latexrelease>\fi
710 %<latexrelease>}%
711 %<latexrelease>\EndIncludeInRelease
712 %<*2ekernel>
713 % \end{macrocode}
714 % \end{macro}
715 %
716 % \begin{macro}{\@endfloatbox}
717 % \changes{v1.1n}{1995/10/25}{(CAR) macro added: to unify code for
718 % double and single versions}
719 % This macro is not intended to be a hook; it is designed to help
720 % maintain the integrity of this code, which is used twice and, as
721 % can be seen, is subject to frequent changes.
722 % \begin{macrocode}
723 \def \@endfloatbox{%
724 \par\vskip\z@skip %% \par\vskip\z@ added 15 Dec 87
725 % \end{macrocode}
726 % \changes{v1.0a}
727 % {1994/03/07}{(DPC) Extra group for colour}
728 % \changes{v1.0c}{1994/03/14}
729 % {(DPC) Use \cs{color@endgroup}}
730 % \changes{v1.0h}{1994/05/20}{Restore outer value of @nobreak switch.}
731 % \changes{v1.1a}{1994/10/31}
732 % {(DPC/CAR) Extra box added to remove colour resetting from vmode}
733 % \changes{v1.1c}{1994/11/05}
734 % {Use new \cs{color@hbox} concept.}
735 % \changes{v1.1f}{1994/11/21}{Corrected position of \cs{outer@nobreak}}
736 % \changes{v1.1f}{1994/11/21}{Added reset of minipage flag}
737 % \changes{v1.1n}{1996/07/26}{remove unnecessary \cs{global} before
738 % \cs{@minipage...}}
739 % \begin{macrocode}
740 \@minipagefalse
741 \outer@nobreak
742 \egroup %% end of vbox
743 \color@endbox
744 }
745 % \end{macrocode}
746 % \end{macro}
747 %
748 % \begin{macro}{\outer@nobreak}
749 % \changes{v1.0h}{1994/05/20}{Macro added: default is to do nothing.}
750 % \begin{macrocode}
751 \let\outer@nobreak\@empty
752 % \end{macrocode}
753 % \end{macro}
754 %
755 %
756 % \begin{macro}{\@largefloatcheck}
757 % \changes{v1.0e}{1994/04/25}{Command added}
758 %
759 % This calculates by how much a float is oversize for the page and
760 % prints this in a warning message.
761 %
762 % \begin{macrocode}
763 \def \@largefloatcheck{%
764 \ifdim \ht\@currbox>\textheight
765 \@tempdima -\textheight
766 \advance \@tempdima \ht\@currbox
767 % \end{macrocode}
768 % \changes{v1.0e}{1994/04/25}{Changed warning message to give more
769 % info}
770 % \begin{macrocode}
771 \@latex@warning {Float too large for page by \the\@tempdima}%
772 \ht\@currbox \textheight
773 \fi
774 }
775 % \end{macrocode}
776 % \end{macro}
777 %
778 % \begin{macro}{\@dbflt}
779 % \begin{macro}{\@xdblfloat}
780 % \changes{v1.1a}{1994/10/31}
781 % {Macros removed: \cs{@dbflt}, \cs{@xdblfloat}}
782 % \changes{v1.1g}{1994/12/10}{Macros reinserted temporarily}
783 %
784 %
785 % \begin{macrocode}
786 \def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[tp]}}
787 \def\@xdblfloat#1[#2]{%
788 \@xfloat{#1}[#2]\hsize\textwidth\linewidth\textwidth}
789 % \end{macrocode}
790 % \end{macro}
791 % \end{macro}
792 %
793 %
794 % Moved to ltoutput 93/12/16
795 % \begin{macrocode}
796 %\newcount\c@topnumber
797 %\newcount\c@dbltopnumber
798 %\newcount\c@bottomnumber
799 %\newcount\c@totalnumber
800 % \end{macrocode}
801 %
802 % \begin{macro}{\@floatplacement}
803 % An analysis of |\@floatplacement|:
804 %
805 % This should be called whenever |\@colht| has been set.
806 % \begin{macrocode}
807 \def\@floatplacement{\global\@topnum\c@topnumber
808 % Textpage bit, global:
809 \global\@toproom \topfraction\@colht
810 \global\@botnum \c@bottomnumber
811 \global\@botroom \bottomfraction\@colht
812 \global\@colnum \c@totalnumber
813 % Floatpage bit, local:
814 \@fpmin \floatpagefraction\@colht}
815 %</2ekernel>
816 % \end{macrocode}
817 % \end{macro}
818 %
819 % \begin{macro}{\@dblfloatplacement}
820 % \changes{LaTeX2e}{1993/12/05}{Command changed}
821 %
822 % This should be called only within a group. Now changed to
823 % provide extra checks in |\@addtodblcol|, needed when processing a
824 % BANG float.
825 %
826 % \changes{v1.2b}{2015/01/11}{float order in 2-column (latexrelease)}
827 % \begin{macrocode}
828 %<latexrelease>\IncludeInRelease{2015/01/01}%
829 %<latexrelease> {\@dblfloatplacement}{float order in 2-column}%
830 %<*2ekernel|latexrelease>
831 % \end{macrocode}
832 % When making two column float area, look for floats with 1sp
833 % depth.
834 % \begin{macrocode}
835 \def\@dblfloatplacement{\global\@dbltopnum\c@dbltopnumber
836 \global\@dbltoproom \dbltopfraction\@colht
837 \@textmin \@colht
838 \advance \@textmin -\@dbltoproom
839 \@fpmin \dblfloatpagefraction\textheight
840 \@fptop \@dblfptop
841 \@fpsep \@dblfpsep
842 \@fpbot \@dblfpbot
843 % \end{macrocode}
844 % |\f@depth| is used in |\@testwrongwidth| to look for either
845 % column or dbl-column floats. A value of |1sp| signals the
846 % latter. Because of this setting here, |\@dblfloatplacment| needs to
847 % be called inside a group which is a questionable design.
848 % \begin{macrocode}
849 \def\f@depth{1sp}}%
850 % \end{macrocode}
851 %
852 % \begin{macrocode}
853 %</2ekernel|latexrelease>
854 %<latexrelease>\EndIncludeInRelease
855 %<latexrelease>\IncludeInRelease{0000/00/00}%
856 %<latexrelease> {\@dblfloatplacement}{float order in 2-column}%
857 %<latexrelease>\def \@dblfloatplacement {%
858 % \end{macrocode}
859 % Textpage bit: global, but need not be.
860 % \begin{macrocode}
861 %<latexrelease> \global \@dbltopnum \c@dbltopnumber
862 %<latexrelease> \global \@dbltoproom \dbltopfraction\@colht
863 % \end{macrocode}
864 % This new bit uses |\@textmin| to locally store the amount of extra
865 % room in the column.
866 % \begin{macrocode}
867 %<latexrelease> \@textmin \@colht
868 %<latexrelease> \advance \@textmin -\@dbltoproom
869 % \end{macrocode}
870 % Floatpage bit: must be local.
871 % \begin{macrocode}
872 %<latexrelease> \@fpmin \dblfloatpagefraction\textheight
873 %<latexrelease> \@fptop \@dblfptop
874 %<latexrelease> \@fpsep \@dblfpsep
875 %<latexrelease> \@fpbot \@dblfpbot
876 %<latexrelease>}%
877 %<latexrelease>\EndIncludeInRelease
878 %<*2ekernel>
879 % \end{macrocode}
880 % \end{macro}
881 %
882 %
883 % \begin{oldcomments}
884 % MARGINAL NOTES:
885 %
886 % Marginal notes use the same mechanism as floats to communicate
887 % with the \output routine. Marginal notes are distinguished from
888 % floats by having a negative placement specification. The command
889 % \marginpar [LTEXT]{RTEXT} generates a marginal note in a parbox,
890 % using LTEXT if it's on the left and RTEXT if it's on the right.
891 % (Default is RTEXT = LTEXT.) It uses the following parameters.
892 %
893 % \marginparwidth : Width of marginal notes.
894 % \marginparsep : Distance between marginal note and text.
895 % the page layout to determine how to move the marginal
896 % note into the margin. E.g., \@leftmarginskip ==
897 % \hskip -\marginparwidth \hskip -\marginparsep .
898 % \marginparpush : Minimum vertical separation between \marginpar's
899 %
900 % Marginal notes are normally put on the outside of the page
901 % if @mparswitch = true, and on the right if @mparswitch = false.
902 % The command \reversemarginpar reverses the side where they
903 % are put. \normalmarginpar undoes \reversemarginpar.
904 % These commands have no effect for two-column output.
905 %
906 % SURPRISE: if two marginal notes appear on the same line of
907 % text, then the second one could appear on the next page, in
908 % a funny position.
909 %
910 %
911 % \marginpar [LTEXT]{RTEXT} ==
912 % BEGIN
913 % if hmode then \@bsphack
914 % \@floatpenalty := -10002
915 % else \@floatpenalty := -10003
916 % fi
917 % if inner
918 % then LaTeX Error: 'Not in outer paragraph mode.'
919 % \@floatpenalty := 0
920 % else if \@freelist has two elements:
921 % then get \@marbox, \@currbox from \@freelist
922 % \count\@marbox :=G -1
923 % else \@floatpenalty := 0
924 % LaTeX Error: 'Too many unprocessed floats'
925 % \@currbox, \@marbox := \@tempboxa %%use \def
926 % fi
927 % fi
928 % if optional argument
929 % then %% \@xmpar ==
930 % \@savemarbox\@marbox{LTEXT}
931 % \@savemarbox\@currbox{RTEXT}
932 % else %% \@ympar ==
933 % \@savemarbox\@marbox{RTEXT}
934 % \box\@currbox :=G \box\@marbox
935 % fi
936 % \@xympar
937 % END
938 %
939 % \reversemarginpar == BEGIN \@mparbottom :=G 0
940 % @reversemargin :=G true
941 % END
942 %
943 % \normalmarginpar == BEGIN \@mparbottom :=G 0
944 % @reversemargin :=G false
945 % END
946 %
947 % \end{oldcomments}
948 %
949 % \begin{macro}{\marginpar}
950 % \begin{macrocode}
951 \def\marginpar{%
952 \ifhmode
953 \@bsphack
954 \@floatpenalty -\@Mii
955 \else
956 \@floatpenalty-\@Miii
957 \fi
958 \ifinner
959 \@parmoderr
960 \@floatpenalty\z@
961 \else
962 \@next\@currbox\@freelist{}{}%
963 \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
964 {\@floatpenalty\z@
965 \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
966 \fi
967 \@ifnextchar [\@xmpar\@ympar}
968 % \end{macrocode}
969 % \end{macro}
970 %
971 % \begin{macro}{\@xmpar}
972 % \begin{macrocode}
973 \long\def\@xmpar[#1]#2{%
974 \@savemarbox\@marbox{#1}%
975 \@savemarbox\@currbox{#2}%
976 \@xympar}
977 % \end{macrocode}
978 % \end{macro}
979 %
980 % \begin{macro}{\@ympar}
981 % \begin{macrocode}
982 \long\def\@ympar#1{%
983 \@savemarbox\@marbox{#1}%
984 \global\setbox\@currbox\copy\@marbox
985 \@xympar}
986 % \end{macrocode}
987 % \end{macro}
988 %
989 % \begin{macro}{\@savemarbox}
990 % \changes{v1.0b}{1994/03/12}
991 % {(DPC) Extra group for colour}
992 % \changes{v1.0c}{1994/03/14}
993 % {(DPC) Use \cs{color@begingroup}}
994 % \changes{v1.0d}{1994/04/18}
995 % {(DPC) Remove Colour support}
996 % \changes{v1.1a}{1994/10/31}
997 % {(DPC/CAR) Extra box added for colour}
998 % \changes{v1.1c}{1994/11/05}
999 % {Use new \cs{color@hbox} concept.}
1000 % \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
1001 % \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak} etc}
1002 % \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage} etc}
1003 % \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
1004 % \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
1005 % \changes{v1.1n}{1996/07/26}{remove unnecessary \cs{global} before
1006 % \cs{@minipage...}}
1007 % \changes{v1.2e}{2021/02/03}{Explicitly end with \cs{par} (gh/489)}
1008 % \begin{macrocode}
1009 %</2ekernel>
1010 %<*2ekernel|latexrelease>
1011 %<latexrelease>\IncludeInRelease{2021/06/01}%
1012 %<latexrelease> {\@savemarbox}{Explicit par for marginpar}%
1013 \long\def \@savemarbox #1#2{%
1014 \global\setbox #1%
1015 \color@vbox
1016 \vtop{%
1017 \hsize\marginparwidth
1018 \@parboxrestore
1019 \@marginparreset
1020 #2\par
1021 \@minipagefalse
1022 \outer@nobreak
1023 }%
1024 \color@endbox
1025 }
1026 %</2ekernel|latexrelease>
1027 %<latexrelease>\EndIncludeInRelease
1028 % \end{macrocode}
1029 %
1030 % \begin{macrocode}
1031 %<latexrelease>\IncludeInRelease{0000/00/00}%
1032 %<latexrelease> {\@savemarbox}{Explicit par for marginpar}%
1033 %<latexrelease>
1034 %<latexrelease>\long\def \@savemarbox #1#2{%
1035 %<latexrelease> \global\setbox #1%
1036 %<latexrelease> \color@vbox
1037 %<latexrelease> \vtop{%
1038 %<latexrelease> \hsize\marginparwidth
1039 %<latexrelease> \@parboxrestore
1040 %<latexrelease> \@marginparreset
1041 %<latexrelease> #2%
1042 %<latexrelease> \@minipagefalse
1043 %<latexrelease> \outer@nobreak
1044 %<latexrelease> }%
1045 %<latexrelease> \color@endbox
1046 %<latexrelease>}
1047 %<latexrelease>\EndIncludeInRelease
1048 %<*2ekernel>
1049 % \end{macrocode}
1050 % \end{macro}
1051 %
1052 % \begin{macro}{\@marginparreset}
1053 % \changes{v1.1f}{1994/11/21}{Macro added}
1054 %
1055 % The rational for allowing these normally global flags to be set
1056 % locally here, via |\@parboxrestore| was stated originally by
1057 % Donald Arseneau and extended by Chris Rowley.
1058 % It is because these flags are only set globally to
1059 % true by section commands, and these should never appear within
1060 % marginals or floats or, indeed, in any group; and they are only ever
1061 % set globally to false when they are definitely true.
1062 %
1063 % If anyone is unhappy with this argument then both flags should be
1064 % treated as in |\@setnobreak|; otherwise this command will be
1065 % redundant.
1066 % \changes{v1.1p}{1996/10/24}
1067 % {Added local settings of flags: dangerous!!}
1068 % \begin{macrocode}
1069 \def \@marginparreset {%
1070 \reset@font
1071 \normalsize
1072 % \let\if@nobreak\iffalse
1073 % \let\if@noskipsec\iffalse
1074 % \@setnobreak
1075 \@setminipage
1076 }
1077 % \end{macrocode}
1078 % \end{macro}
1079 %
1080 % \begin{macro}{\@xympar}
1081 % \begin{macrocode}
1082 % \end{macrocode}
1083 % \changes{LaTeX2.09}{1992/03/18}
1084 % {(RmS) added \cs{global}\cs{@ignorefalse}}
1085 % \changes{v1.0b}{1994/03/12}
1086 % {(DPC) Extra bgroup for colour}
1087 % \changes{1.0c}{1994/03/14}
1088 % {(DPC) Use \cs{color@begingroup}}
1089 % \changes{v1.1a}{1994/10/31}
1090 % {(DPC/CAR) Extra box added since needed for floats}
1091 % \changes{v1.1c}{1994/11/05}
1092 % {Use new \cs{color@hbox} concept.}
1093 % \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
1094 % Setting the box here is done only because the code
1095 % uses \cs{end@float}; it will be empty and gets discarded.
1096 % \changes{v1.1o}{1996/08/02}{Remove \cs{global} before \cs{@ignore...}}
1097 % \begin{macrocode}
1098 \def \@xympar{%
1099 \ifnum\@floatpenalty <\z@\@cons\@currlist\@marbox\fi
1100 \setbox\@tempboxa
1101 \color@vbox
1102 \vbox \bgroup
1103 \end@float
1104 \@ignorefalse
1105 \@esphack
1106 }
1107 % \end{macrocode}
1108 % \end{macro}
1109 %
1110 % \begin{macro}{\reversemarginpar}
1111 % \begin{macro}{\normalmarginpar}
1112 % \begin{macrocode}
1113 \def\reversemarginpar{\global\@mparbottom\z@ \@reversemargintrue}
1114 \def\normalmarginpar{\global\@mparbottom\z@ \@reversemarginfalse}
1115 % \end{macrocode}
1116 % \end{macro}
1117 % \end{macro}
1118 %
1119 % \begin{macrocode}
1120 \message{footnotes,}
1121 % \end{macrocode}
1122 %
1123 % \subsection{Footnotes}
1124 %
1125 % \begin{oldcomments}
1126 %
1127 % \footnote{NOTE} : User command to insert a footnote.
1128 %
1129 % \footnote[NUM]{NOTE}: User command to insert a footnote numbered
1130 % NUM, where NUM is a number -- 1, 2,
1131 % etc. For example, if footnotes are numbered
1132 % *, **, etc. within pages, then \footnote[2]{...}
1133 % produces footnote '**'. This command does not
1134 % step the footnote counter.
1135 %
1136 % \footnotemark[NUM] : Command to produce just the footnote mark in
1137 % the text, but no footnote. With no argument,
1138 % it steps the footnote counter before generating
1139 % the mark.
1140 %
1141 % \footnotetext[NUM]{TEXT} : Command to produce the footnote but
1142 % no mark. \footnote is equivalent to
1143 % \footnotemark \footnotetext .
1144 %
1145 % As in PLAIN, footnotes use \insert\footins, and the following
1146 % parameters:
1147 %
1148 % \footnotesize : Size-changing command for footnotes.
1149 %
1150 % \footnotesep : The height of a strut placed at the beginning of
1151 % every footnote.
1152 % \skip\footins : Space between main text and footnotes. The rule
1153 % separating footnotes from text occurs in this
1154 % space. This space lies above the strut of height
1155 % \footnotesep which is at the beginning of the
1156 % first footnote.
1157 % \footnoterule : Macro to draw the rule separating footnotes from
1158 % text. It is executed right after a \vspace of
1159 % \skip\footins. It should take zero vertical
1160 % space--i.e., it should to a negative skip to
1161 % compensate for any positive space it occupies.
1162 % (See PLAIN.TEX.)
1163 %
1164 % \interfootnotelinepenalty : Interline penalty for footnotes.
1165 %
1166 % \thefootnote : In usual LaTeX style, produces the footnote number.
1167 % If footnotes are to be numbered within pages, then
1168 % the document style file must include an \@addtoreset
1169 % command to cause the footnote counter to be reset
1170 % when the page counter is stepped. This is not a good
1171 % idea, though, because the counter will not always be
1172 % reset in time to ensure that the first footnote on a
1173 % page is footnote number one.
1174 %
1175 % \@thefnmark : Holds the current footnote's mark--e.g., \dag or '1'
1176 % or 'a'.
1177 %
1178 % \@mpfnnumber : A macro that generates the numbers for \footnote
1179 % and \footnotemark commands. It == \thefootnote
1180 % outside a minipage environment, but can be
1181 % changed inside to generate numbers for
1182 % \footnote's.
1183 %
1184 % \@makefnmark : A macro to generate the footnote marker from
1185 % \@thefnmark The default definition was
1186 % \hbox{$^\@thefnmark$}.
1187 %
1188 % This is now replaced by
1189 % \textsuperscript{\@thefnmark}
1190 %
1191 % \@makefntext{NOTE} :
1192 % Must produce the actual footnote, using \@thefnmark as the mark
1193 % of the footnote and NOTE as the text. It is called when
1194 % effectively inside a \parbox, with \hsize = \columnwidth.
1195 % For example, it might be as simple as
1196 % $^{\@thefnmark}$ NOTE
1197 %
1198 % In a minipage environment, \footnote and \footnotetext are redefined
1199 % so that
1200 % (a) they use the counter mpfootnote
1201 % (b) the footnotes they produce go at the bottom of the minipage.
1202 % The switch is accomplished by letting \@mpfn == footnote or mpfootnote
1203 % and \thempfn == \thefootnote or \thempfootnote, and by redefining
1204 % \@footnotetext to be \@mpfootnotetext in the minipage.
1205 %
1206 % \footnote{NOTE} ==
1207 % BEGIN
1208 % \stepcounter{\@mpfn}
1209 % begingroup
1210 % \protect == \noexpand
1211 % \@thefnmark :=G eval (\thempfn)
1212 % endgroup
1213 % \@footnotemark
1214 % \@footnotetext{NOTE}
1215 % END
1216 %
1217 % \footnote[NUM]{NOTE} ==
1218 % BEGIN
1219 % begingroup
1220 % \protect == \noexpand
1221 % counter \@mpfn :=L NUM
1222 % \@thefnmark :=G eval (\thempfn)
1223 % endgroup
1224 % \@footnotemark
1225 % \@footnotetext{NOTE}
1226 % END
1227 %
1228 % \footnotemark ==
1229 % BEGIN \stepcounter{footnote}
1230 % begingroup
1231 % \protect == \noexpand
1232 % \@thefnmark :=G eval(\thefootnote)
1233 % endgroup
1234 % \@footnotemark
1235 % END
1236 %
1237 % \footnotemark[NUM] ==
1238 % BEGIN
1239 % begingroup
1240 % footnote counter :=L NUM
1241 % \protect == \noexpand
1242 % \@thefnmark :=G eval(\thefootnote)
1243 % endgroup
1244 % \@footnotemark
1245 % END
1246 %
1247 % \@footnotemark ==
1248 % BEGIN
1249 % \leavevmode
1250 % IF hmode THEN \@x@sf := \the\spacefactor FI
1251 % \@makefnmark % put number in main text
1252 % IF hmode THEN \spacefactor := \@x@sf FI
1253 % END
1254 %
1255 % \footnotetext ==
1256 % BEGIN begingroup \protect == \noexpand
1257 % \@thefnmark :=G eval (\thempfn)
1258 % endgroup
1259 % \@footnotetext
1260 % END
1261 %
1262 % \footnotetext[NUM] ==
1263 % BEGIN begingroup counter \@mpfn :=L NUM
1264 % \protect == \noexpand
1265 % \@thefnmark :=G eval (\thempfn)
1266 % endgroup
1267 % \@footnotetext
1268 % END
1269 %
1270 % \end{oldcomments}
1271 %
1272 %
1273 % \changes{v1.1l}{1995/05/24}{Moved definition of \cs{footins}
1274 % and \cs{footnoterule} from ltplain.}
1275 %
1276 % \begin{macro}{\footins}
1277 % \LaTeX\ does use the same insert for footnotes as PLAIN.
1278 % \begin{macrocode}
1279 \newinsert\footins
1280 % \end{macrocode}
1281 %
1282 % \LaTeX\ leaves these initializations for the |\footins| insert.
1283 %
1284 % \begin{macrocode}
1285 \skip\footins=\bigskipamount % space added when footnote is present
1286 \count\footins=1000 % footnote magnification factor (1 to 1)
1287 \dimen\footins=8in % maximum footnotes per page
1288 % \end{macrocode}
1289 % \end{macro}
1290 %
1291 %
1292 % \begin{macro}{\footnoterule}
1293 % \LaTeX\ keeps PLAIN \TeX's |\footnoterule| as the default.
1294 %
1295 % \begin{macrocode}
1296 \def\footnoterule{\kern-3\p@
1297 \hrule \@width 2in \kern 2.6\p@} % the \hrule is .4pt high
1298 % \end{macrocode}
1299 % \end{macro}
1300 %
1301 % \begin{macro}{\thefootnote}
1302 % \changes{v1.1i}{1995/05/16}{Streamlined parts of code.}
1303 % \begin{macrocode}
1304 \@definecounter{footnote}
1305 \def\thefootnote{\@arabic\c@footnote}
1306 % \end{macrocode}
1307 % \end{macro}
1308 %
1309 % \begin{macro}{\thempfootnote}
1310 % \changes{v1.1j}{1995/05/18}{Added \cs{itshape}.}
1311 % \changes{v1.1v}{2002/10/01}{Use braces around \cs{itshape}
1312 % to keep font change local (pr/3460).}
1313 % The default display for the footnote counter in minipages is to
1314 % use italic letters. We use |\itshape| not |\textit| as the latter
1315 % would add an italic correction.
1316 % \begin{macrocode}
1317 \@definecounter{mpfootnote}
1318 \def\thempfootnote{{\itshape\@alph\c@mpfootnote}}
1319 % \end{macrocode}
1320 % \end{macro}
1321 %
1322 % \begin{macro}{\@makefnmark}
1323 % \changes{v1.1i}{1995/05/16}{Now use \cs{textsuperscript}.}
1324 % \changes{v1.1j}{1995/05/18}{Added \cs{normalfont}.}
1325 % \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} to
1326 % \cs{textsuperscript}}
1327 % \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} back
1328 % and use \cs{@textsuperscript}}
1329 % Default definition.
1330 % \begin{macrocode}
1331 %\def\@makefnmark{\hbox{$^{\@thefnmark}\m@th$}}
1332 \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}}
1333 % \end{macrocode}
1334 % \end{macro}
1335 %
1336 % \begin{macro}{\textsuperscript}
1337 % \changes{v1.1i}{1995/05/16}{Command added./pr1503}
1338 % \changes{v1.1k}{1995/05/20}{Use \cs{normalfont}.}
1339 % \changes{v1.1l}{1995/05/24}{Use \cs{@textsuperscript}}
1340 % This command provides superscript characters in the current text
1341 % font. It's implementation might change!!!
1342 % \begin{macrocode}
1343 \DeclareRobustCommand*\textsuperscript[1]{%
1344 \@textsuperscript{\selectfont#1}}
1345 % \end{macrocode}
1346 % \end{macro}
1347 %
1348 % \begin{macro}{\@textsuperscript}
1349 % \changes{v1.1l}{1995/05/24}{Command added.}
1350 % \changes{v1.1n}{1995/12/05}{Use \cs{ensuremath} for latex/1984.}
1351 % \changes{v1.1m}{1995/12/07}
1352 % {Move \cs{m@th} out of the \cs{ensuremath} for latex/1984.}
1353 % This command should not be used directly, but may be used to define
1354 % other commands |\textsuperscript|, |\@makefnmark|. |#1| should
1355 % always start with a font selection command, to activate the font
1356 % size switch.
1357 % \begin{macrocode}
1358 %</2ekernel>
1359 %<*2ekernel|latexrelease>
1360 %<latexrelease>\IncludeInRelease{2020/10/01}%
1361 %<latexrelease> {\@textsuperscript}{superscript baseline}%
1362 \def\@textsuperscript#1{%
1363 {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\sf@size#1}}}}}
1364 %</2ekernel|latexrelease>
1365 %<latexrelease>\EndIncludeInRelease
1366 % \end{macrocode}
1367 %
1368 % \begin{macrocode}
1369 %<latexrelease>\IncludeInRelease{0000/00/00}%
1370 %<latexrelease> {\@textsuperscript}{superscript baseline}%
1371 %<latexrelease>
1372 %<latexrelease>\def\@textsuperscript#1{%
1373 %<latexrelease> {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}
1374 %<latexrelease>\EndIncludeInRelease
1375 %<*2ekernel>
1376 % \end{macrocode}
1377 % \end{macro}
1378 %
1379 %
1380 %
1381 %
1382 %
1383 %
1384 %
1385 % \begin{macro}{\textsubscript}
1386 % \changes{v1.2a}{2014/12/30}{Command added (latexrelease)}
1387 % \changes{v1.2d}{2020/04/09}{Set non-zero baseline (gh/249)}
1388 % \begin{macrocode}
1389 %</2ekernel>
1390 %<latexrelease>\IncludeInRelease{2015/01/01}%
1391 %<latexrelease> {\textsubscript}{\textsubscript}%
1392 %<*2ekernel|latexrelease>
1393 % \end{macrocode}
1394 %
1395 % \begin{macrocode}
1396 \DeclareRobustCommand*\textsubscript[1]{%
1397 \@textsubscript{\selectfont#1}}%
1398 % \end{macrocode}
1399 %
1400 % \begin{macrocode}
1401 %</2ekernel|latexrelease>
1402 %<latexrelease>\EndIncludeInRelease
1403 %<latexrelease>\IncludeInRelease{0000/00/00}%
1404 %<latexrelease> {\textsubscript}{\textsubscript}%
1405 %<latexrelease>\let\textsubscript\@undefined
1406 %<latexrelease>\EndIncludeInRelease
1407 %<*2ekernel>
1408 % \end{macrocode}
1409 % \end{macro}
1410 %
1411 %
1412 %
1413 %
1414 % \begin{macro}{\@textsubscript}
1415 % \changes{v1.2a}{2014/12/30}{Command added (latexrelease)}
1416 % \changes{v1.2d}{2020/04/09}{Set non-zero baseline (gh/249)}
1417 % \begin{macrocode}
1418 %</2ekernel>
1419 %<*2ekernel|latexrelease>
1420 %<latexrelease>\IncludeInRelease{2020/10/01}%
1421 %<latexrelease> {\@textsubscript}{subscript baseline}%
1422 \def\@textsubscript#1{%
1423 {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\sf@size#1}}}}}
1424 %</2ekernel|latexrelease>
1425 %<latexrelease>\EndIncludeInRelease
1426 % \end{macrocode}
1427 %
1428 % \begin{macrocode}
1429 %<latexrelease>\IncludeInRelease{2015/01/01}%
1430 %<latexrelease> {\@textsubscript}{subscript baseline}%
1431 %<latexrelease>
1432 %<latexrelease>\def\@textsubscript#1{%
1433 %<latexrelease> {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
1434 % \end{macrocode}
1435 %
1436 % \begin{macrocode}
1437 %<latexrelease>\EndIncludeInRelease
1438 %<latexrelease>\IncludeInRelease{0000/00/00}%
1439 %<latexrelease> {\@textsubscript}{subscript baseline}%
1440 %<latexrelease>\let\@textsubscript\@undefined
1441 %<latexrelease>\EndIncludeInRelease
1442 %<*2ekernel>
1443 % \end{macrocode}
1444 % \end{macro}
1445 %
1446 %
1447 %
1448 % \begin{macro}{\footnotesep}
1449 % \begin{macrocode}
1450 \newdimen\footnotesep
1451 % \end{macrocode}
1452 %
1453 % \end{macro}
1454 %
1455 % \begin{macro}{\footnote}
1456 % \changes{LaTeX2.09}{1991/11/01}
1457 % {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
1458 % \cs{footnote}, \cs{footnotemark},
1459 % and \cs{footnotetext}, since \cs{xdef} is used}
1460 % \changes{LaTeX2.09}{1991/11/22}
1461 % {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
1462 % \cs{@xfootnote}, \cs{@xfootnotemark},
1463 % and \cs{@xfootnotetext}}
1464 % \changes{LaTeX2.09}{1992/11/26}
1465 % {(RmS) Changed all to
1466 % `def`protect\string{`noexpand`protect`noexpand\string}}
1467 % \changes{v1.1b}{1994/11/26}
1468 % {(ASAJ) Added \cs{protected@xdef}.}
1469 %
1470 % \begin{macrocode}
1471 \def\footnote{\@ifnextchar[\@xfootnote{\stepcounter\@mpfn
1472 \protected@xdef\@thefnmark{\thempfn}%
1473 \@footnotemark\@footnotetext}}
1474 % \end{macrocode}
1475 % \end{macro}
1476 %
1477 % \begin{macro}{\@xfootnote}
1478 % \begin{macrocode}
1479 \def\@xfootnote[#1]{%
1480 \begingroup
1481 \csname c@\@mpfn\endcsname #1\relax
1482 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1483 \endgroup
1484 \@footnotemark\@footnotetext}
1485 % \end{macrocode}
1486 % \end{macro}
1487 %
1488 % \begin{macro}{\@footnotetext}
1489 % \changes{LaTeX2.09}{1991/09/29}
1490 % {(RmS) added \cs{reset@font}}
1491 % \changes{LaTeX2.09}{1992/11/26}
1492 % {(RmS) added protection for \cs{edef}}
1493 % \changes{v1.0a}{1994/03/07}
1494 % {(DPC) Extra group for colour}
1495 % \changes{v1.0c}{1994/03/14}
1496 % {(DPC) Use \cs{color@begingroup}, add \cs{endgraf}}
1497 % \changes{v1.0d}{1994/04/18}
1498 % {(DPC) Remove Colour support}
1499 % \changes{v1.0g}{1994/05/13}
1500 % {(DPC) Add new style colour support: \cs{normalcolor}}
1501 % \changes{v1.0g}{1994/05/13}
1502 % {(DPC) Use \cs{@finalstrut}}
1503 % \changes{v1.1a}{1994/10/31}
1504 % {(DPC/CAR) Move colour setting to output routine}
1505 % \changes{v1.1b}{1994/11/04}
1506 % {(ASAJ) Added \cs{protected@edef}.}
1507 % \changes{v1.1c}{1994/11/05}
1508 % {Removed \cs{normalcolor} (again)}
1509 % \changes{v1.1t}{1997/11/19}
1510 % {Missing percent, again}
1511 % \changes{v1.2e}{2021/02/10}{Explicitly run \cs{par} at the end of footnote text
1512 % in preparation for paragraph hooks}
1513 % \changes{v1.2g}{2021/10/14}
1514 % {Explicitly set \cs{@currentcounter} (gh/687)}
1515 % \begin{macrocode}
1516 %</2ekernel>
1517 %<*2ekernel|latexrelease>
1518 %<latexrelease>\IncludeInRelease{2021/11/15}%
1519 %<latexrelease> {\@footnotetext}{footnotetext tagging}%
1520 \long\def\@footnotetext#1{\insert\footins{%
1521 \reset@font\footnotesize
1522 \interlinepenalty\interfootnotelinepenalty
1523 \splittopskip\footnotesep
1524 \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
1525 \hsize\columnwidth \@parboxrestore
1526 \def\@currentcounter{footnote}%
1527 \protected@edef\@currentlabel{%
1528 \csname p@footnote\endcsname\@thefnmark
1529 }%
1530 \color@begingroup
1531 \@makefntext{%
1532 \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1533 \par
1534 \color@endgroup}}%
1535 %</2ekernel|latexrelease>
1536 %<latexrelease>\EndIncludeInRelease
1537 % \end{macrocode}
1538 %
1539 % \begin{macrocode}
1540 %<latexrelease>\IncludeInRelease{2021/06/01}%
1541 %<latexrelease> {\@footnotetext}{footnotetext tagging}%
1542 %<latexrelease>\long\def\@footnotetext#1{\insert\footins{%
1543 %<latexrelease> \reset@font\footnotesize
1544 %<latexrelease> \interlinepenalty\interfootnotelinepenalty
1545 %<latexrelease> \splittopskip\footnotesep
1546 %<latexrelease> \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
1547 %<latexrelease> \hsize\columnwidth \@parboxrestore
1548 %<latexrelease> \protected@edef\@currentlabel{%
1549 %<latexrelease> \csname p@footnote\endcsname\@thefnmark
1550 %<latexrelease> }%
1551 %<latexrelease> \color@begingroup
1552 %<latexrelease> \@makefntext{%
1553 %<latexrelease> \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1554 %<latexrelease> \par
1555 %<latexrelease> \color@endgroup}}%
1556 %<latexrelease>\EndIncludeInRelease
1557 % \end{macrocode}
1558 %
1559 % \begin{macrocode}
1560 %<latexrelease>\IncludeInRelease{0000/00/00}%
1561 %<latexrelease> {\@footnotetext}{footnotetext tagging}%
1562 %<latexrelease>
1563 %<latexrelease>\long\def\@footnotetext#1{\insert\footins{%
1564 %<latexrelease> \reset@font\footnotesize
1565 %<latexrelease> \interlinepenalty\interfootnotelinepenalty
1566 %<latexrelease> \splittopskip\footnotesep
1567 %<latexrelease> \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
1568 %<latexrelease> \hsize\columnwidth \@parboxrestore
1569 %<latexrelease> \protected@edef\@currentlabel{%
1570 %<latexrelease> \csname p@footnote\endcsname\@thefnmark
1571 %<latexrelease> }%
1572 %<latexrelease> \color@begingroup
1573 %<latexrelease> \@makefntext{%
1574 %<latexrelease> \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1575 %<latexrelease> \color@endgroup}}%
1576 %<latexrelease>
1577 %<latexrelease>\EndIncludeInRelease
1578 %<*2ekernel>
1579 % \end{macrocode}
1580 % \end{macro}
1581 %
1582 % \begin{macro}{\footnotemark}
1583 % \changes{v1.1b}{1994/11/04}{Added \cs{protected@xdef} to
1584 % \cs{footnotemark}.}
1585 % \begin{macrocode}
1586 \def\footnotemark{%
1587 \@ifnextchar[\@xfootnotemark
1588 {\stepcounter{footnote}%
1589 \protected@xdef\@thefnmark{\thefootnote}%
1590 \@footnotemark}}
1591 % \end{macrocode}
1592 % \end{macro}
1593 %
1594 % \begin{macro}{\@xfootnotemark}
1595 % \begin{macrocode}
1596 \def\@xfootnotemark[#1]{%
1597 \begingroup
1598 \c@footnote #1\relax
1599 \unrestored@protected@xdef\@thefnmark{\thefootnote}%
1600 \endgroup
1601 \@footnotemark}
1602 % \end{macrocode}
1603 % \end{macro}
1604 %
1605 % \begin{macro}{\@footnotemark}
1606 % \changes{v1.1h}{1995/05/12}
1607 % {Add \cs{nobreak} to allow hyphenation. latex/1605}
1608 % \begin{macrocode}
1609 \def\@footnotemark{%
1610 \leavevmode
1611 \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
1612 \@makefnmark
1613 \ifhmode\spacefactor\@x@sf\fi
1614 \relax}
1615 % \end{macrocode}
1616 % \end{macro}
1617 %
1618 % \begin{macro}{\footnotetext}
1619 % \begin{macrocode}
1620 \def\footnotetext{%
1621 \@ifnextchar [\@xfootnotenext
1622 {\protected@xdef\@thefnmark{\thempfn}%
1623 \@footnotetext}}
1624 % \end{macrocode}
1625 % \end{macro}
1626 %
1627 % \begin{macro}{\@xfootnotenext}
1628 % \begin{macrocode}
1629 \def\@xfootnotenext[#1]{%
1630 \begingroup
1631 \csname c@\@mpfn\endcsname #1\relax
1632 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1633 \endgroup
1634 \@footnotetext}
1635 % \end{macrocode}
1636 % \end{macro}
1637 %
1638 % \begin{macro}{\thempfn}
1639 % \begin{macro}{\@mpfn}
1640 % \begin{macrocode}
1641 \def\@mpfn{footnote}
1642 \def\thempfn{\thefootnote}
1643 % \end{macrocode}
1644 %
1645 % \end{macro}
1646 % \end{macro}
1647 %
1648 %
1649 %
1650 %
1651 % \begin{macro}{\footref}
1652 % This command generates a footnote mark. The value is produced by
1653 % referencing a \cs{label} placed into a \cs{footnote} elsewhere
1654 % (can be one in the main galley or in a minipage).
1655 % \changes{v1.2f}{2021/02/16}{\cs{footref} added}
1656 % \begin{macrocode}
1657 %</2ekernel>
1658 %<*2ekernel|latexrelease>
1659 %<latexrelease>\IncludeInRelease{2021/06/01}%
1660 %<latexrelease> {\footref}{Add footref}%
1661 \def\footref#1{%
1662 \begingroup
1663 \unrestored@protected@xdef\@thefnmark{\ref{#1}}%
1664 \endgroup
1665 \@footnotemark
1666 }
1667 %</2ekernel|latexrelease>
1668 %<latexrelease>\EndIncludeInRelease
1669 % \end{macrocode}
1670 % We don't remove it when rolling back so that packages offered it
1671 % in the past do not need to alter their behavior in a rollback
1672 % situation.
1673 % \begin{macrocode}
1674 %<latexrelease>\IncludeInRelease{0000/00/00}%
1675 %<latexrelease> {\footref}{Add footref}%
1676 %<latexrelease>
1677 %<latexrelease> % \let\footref\@undefined
1678 %<latexrelease>
1679 %<latexrelease>\EndIncludeInRelease
1680 %<*2ekernel>
1681 % \end{macrocode}
1682 % \end{macro}
1683 %
1684 %
1685 % \begin{macrocode}
1686 %</2ekernel>
1687 % \end{macrocode}
1688 %
1689 % \Finale
1690 %