Debian Codegraph @

texmf-dist/source/latex/base/ltoutput.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: ltoutput.dtx
31 %<flafter>\ProvidesPackage{flafter}
32 %<fltrace>\ProvidesPackage{fltrace}
33 %<flafter,fltrace> [2025/08/22 v1.4z
34 %<flafter> Standard LaTeX floats after reference (FMi)]
35 %<fltrace> Tracing LaTeX floats algorithm (FMi)]
36 %
37 %<*driver>
38 % \fi
39 \ProvidesFile{ltoutput.dtx}
40 [2025/08/22 v1.4z LaTeX Kernel (Output Routine)]
41 % \iffalse
42 \documentclass{ltxdoc}
43 \GetFileInfo{ltoutput.dtx}
44 \title{\filename}
45 \date{\filedate}
46 \author{Leslie Lamport, Frank Mittelbach, Chris Rowley}
47 \begin{document}
48 \MaintainedByLaTeXTeam{latex}
49 \maketitle \tableofcontents
50 \DocInput{\filename}
51 \end{document}
52 %</driver>
53 % \fi
54 %
55 %
56 % \providecommand\hook[1]{\texttt{#1\DescribeHook[noprint]{#1}}}
57 % \providecommand\socket[1]{\texttt{#1\DescribeSocket[noprint]{#1}}}
58 % \providecommand\plug[1]{\texttt{#1\DescribePlug[noprint]{#1}}}
59 %
60 % \ProvideDocElement[printtype=\textit{socket},idxtype=socket,idxgroup=Sockets]{Socket}{socketdecl}
61 % \ProvideDocElement[printtype=\textit{plug},idxtype=plug,idxgroup=Plugs]{Plug}{plugdecl}
62 % \ProvideDocElement[printtype=\textit{hook},idxtype=hook,idxgroup=Hooks]{Hook}{hookdecl}
63 %
64 %
65 % \iffalse
66 % LATEX VERSION 2e
67 % Copyright (C) 1992 Leslie Lamport
68 % Copyright (C) 1994-2000 Leslie Lamport, LaTeX Project
69 %
70 % LaTeX 2e kernel file for the output routine.
71 %
72 % Part of this file is the latest (not greatest, it still
73 % deserves its name) version of kludge.sty.
74 %
75 % It also contains a few enhancements and many changes (corrections
76 % and tidyings) to the float mechanism and other parts of the output
77 % routine.
78 %
79 % The tracing in the file at present is mainly to help in testing the
80 % code but it may well be developed into a full float tracing
81 % package one day.
82 %
83 % ============================
84 % \fi
85 %
86 % \changes{v1.1p}{1995/08/25}{Support autoloading feature (FMi).}
87 % \task{CAR}{Update documentation.}
88 % \changes{v1.0k}{1994/02/08}{Documentation and tasks tidied.}
89 % \changes{v1.0l}{1994/03/15}{Driver added and further tidying.}
90 % \changes{v1.0l}{1994/03/15}{Some boxmaxdepth settings removed.}
91 % \changes{v1.0l}{1994/03/15}{Added some warnings when page gets full of
92 % top floats.}
93 % \changes{v1.0l}{1994/03/15}{Removed duplicated code and corrected
94 % docstrip options.}
95 % \changes{v1.0m}{1994/04/24}{Removed some long lines and other
96 % aesthetic changes.}
97 % \changes{v1.0m}{1994/04/24}{Corrected unverbed commands in
98 % documentation.}
99 % \changes{v1.0m}{1994/04/24}{Changed \cs{@normalsize} to
100 % \cs{normalsize}.}
101 % \changes{v1.0m}{1994/04/24}{Warning messages changed/corrected.}
102 % \changes{v1.0n}{1994/04/30}{Added \cs{col@number}.}
103 % \changes{v1.0n}{1994/04/30}{Fixed bug from \cs{dblfigrule} with
104 % \cs{@topnewpage}.}
105 % \changes{v1.0n}{1994/04/30}{Documentation tidied.}
106 % \changes{v1.0n}{1994/04/30}{\cs{@activechar@warning} changed to an
107 % info message.}
108 % \changes{v1.0n}{1994/04/30}{Full of floats action improved.}
109 % \changes{v1.0n}{1994/04/30}{Empty column action added.}
110 % \changes{v1.0o}{1994/05/02}{Code of \cs{@resethfps} shortened.}
111 % \changes{v1.0p}{1994/05/12}{\cs{normalcolor}added in various
112 % places (DPC).}
113 % \changes{v1.0q}{1994/05/16}{Changed setting of accents (FMi).}
114 % \changes{v1.0s}{1994/05/20}{Added setting of \cs{protect}
115 % during \cs{shipout}.}
116 % \changes{v1.0t}{1994/05/22}{Changed warnings and infos to
117 % new commands.}
118 % \changes{v1.0u}{1994/05/23}{Added \cs{MessageBreak}.}
119 % \changes{v1.0u}{1994/05/23}{Changed resetting of \cs{protect} after
120 % shipout.}
121 % \changes{v1.0v}{1994/05/25}{Extra documentation.}
122 % \changes{v1.0w}{1994/06/01}{Tidied up typesetting.}
123 %
124 % \changes{v1.1f}{1994/11/14}{Removed old definition of \cs{@testfp}.}
125 % \changes{v1.1h}{1994/11/17}
126 % {\cs{@tempa} to \cs{reserved@a}.}
127 % \changes{v1.1m}{1995/05/07}{Use \cs{hb@xt@}.}
128 % \changes{v1.2n}{2015/02/21}
129 % {Removed autoload code}
130 %
131 % \MaybeStop{}
132 %
133 % \def \ie {i.e.~}
134 % \def \eg {e.g.~}
135 %
136 % \section{Output Routine and float handling}
137 %
138 %
139 % \begin{macrocode}
140 %<*2ekernel>
141 \message{output,}
142 % \end{macrocode}
143 %
144 % \subsection{Historical notes on the algorithm and commands}
145 %
146 %
147 % \begin{oldcomments}
148 % ****************************************
149 % * OUTPUT *
150 % ****************************************
151 %
152 %
153 % PAGE LAYOUT PARAMETERS
154 %
155 % \topmargin : Extra space added to top of page.
156 % @twoside : boolean. T if two-sided printing
157 % \oddsidemargin : IF @twoside = T
158 % THEN extra space added to left of odd-numbered
159 % pages.
160 % ELSE extra space added to left of all pages.
161 % \evensidemargin : IF @twoside = T
162 % THEN extra space added to left of even-numbered
163 % pages.
164 % \headheight : height of head
165 % \headsep : separation between head and text
166 % \footskip : distance separation between baseline of last
167 % line of text and baseline of foot.
168 % Note difference between \footSKIP and \headSEP.
169 % \textheight : height of text on page, excluding head and foot
170 % \textwidth : width of printing on page
171 % \columnsep : IF @twocolumn = T
172 % THEN width of space between columns
173 % \columnseprule : IF @twocolumn = T
174 % THEN width of rule between columns (0 if none).
175 % \columnwidth : IF @twocolumn = T
176 % THEN (\textwidth - \columnsep)/2
177 % ELSE \textwidth
178 % It is set by the \twocolumn and
179 % \onecolumn commands.
180 % \@textbottom : Command executed at bottom of vbox holding text of
181 % page (including figures). The \raggedbottom
182 % command almost \let's this to \vfil (actually sets
183 % it to \vskip \z@ plus.0001fil).
184 % Should have depth 0pt.
185 %
186 % \@texttop : Command executed at top of vbox holding text of
187 % page (including figures). Used by letter style;
188 % can also be used to produce centered pages.
189 % Let to \relax by \raggedbottom and \flushbottom.
190 %
191 % Page layout must initialize \@colht and \@colroom to \textheight.
192 %
193 % PAGE STYLE PARAMETERS:
194 %
195 % \floatsep : Space left between floats.
196 % \textfloatsep : Space between last top float or first bottom float
197 % and the text.
198 % \topfigrule : Command to place rule (or whatever) between floats
199 % at top of page and text. Executed in inner
200 % vertical mode right before the \textfloatsep skip
201 % separating the floats from the text. Must occupy
202 % zero vertical space. (See \footnoterule.)
203 % \botfigrule : Same as \topfigrule, but put after the
204 % \textfloatsep skip separating text from the
205 % floats at bottom of page.
206 % \intextsep : Space left on top and bottom of an in-text float.
207 % \dblfloatsep : Space between double-column floats.
208 % \dbltextfloatsep : Space between top double-column floats
209 % and text.
210 % \dblfigrule : Similar to \topfigrule, but for double-column
211 % floats.
212 % \@fptop : Glue to go at top of float column -- must be 0pt +
213 % stretch
214 % \@fpsep : Glue to go between floats in a float column.
215 % \@fpbot : Glue to go at bottom of float column
216 % -- must be 0pt +
217 % stretch
218 % \@dblfptop, \@dblfpsep, \@dblfpbot
219 % : Analogous for double-column float page in
220 % two-column format.
221 %
222 % FOOTNOTES: As in PLAIN, footnotes use \insert\footins.
223 %
224 % PAGE LAYOUT SWITCHES AND MACROS
225 %
226 % @twocolumn : Boolean. T if two columns per page globally.
227 %
228 % PAGE STYLE MACROS AND SWITCHES
229 %
230 % \@oddhead : IF @twoside = T
231 % THEN macro to generate head of odd-numbered
232 % pages.
233 % ELSE macro to generate head of all pages.
234 % \@evenhead : IF @twoside = T
235 % THEN macro to generate head of even-numbered
236 % pages.
237 % \@oddfoot : IF @twoside = T
238 % THEN macro to generate foot of odd-numbered
239 % pages.
240 % ELSE macro to generate foot of all pages.
241 % \@evenfoot : IF @twoside = T
242 % THEN macro to generate foot of even-numbered
243 % pages.
244 % @specialpage : boolean. T if current page is to have a special
245 % format.
246 % \@specialstyle : If its value is foo then
247 % IF @specialpage = T
248 % THEN the command \ps@foo is executed to
249 % temporarily reset the page style parameters
250 % before composing the current page.
251 % This command should execute only \def's and
252 % \edef's, making only local definitions.
253 %
254 % FLOAT PLACEMENT PARAMETERS
255 %
256 % The following parameters are set by the macro \@floatplacement.
257 % When \@floatplacement is called,
258 % \@colht is the height of the page or column being built. I.e.:
259 % * For single-column page it equals \textheight.
260 % * For double-column page it equals \textheight - height
261 % of double-column floats on page.
262 % Note that some are set globally and some locally:
263 % \@topnum :=G Maximum number of floats allowed on the top of a
264 % column.
265 % \@toproom :=G Maximum amount of top of column devoted to floats--
266 % excluding \textfloatsep separation below the floats
267 % and \floatsep separation between them. For
268 % two-column output, should be computed as a function
269 % of \@colht.
270 % \@botnum, \@botroom
271 % : Analogous to above.
272 % \@colnum :=G Maximum number of floats allowed in a column,
273 % including in-text floats.
274 % \@textmin :=L Minimum amount of text (excluding footnotes) that
275 % must appear on a text page.
276 % %% 27 Sep 85 : made local to
277 % %% \@addtocurcol and \@addtonextcol
278 % It is now also used locally in processing double
279 % floats.
280 % \@fpmin :=L Minimum height of floats in a float column.
281 %
282 % The macro \@dblfloatplacement sets the following parameters.
283 % \@dbltopnum :=G Maximum number of double-column floats allowed at
284 % the top of a two-column page.
285 % \@dbltoproom :=G Maximum height of double-column floats allowed at
286 % top of two-column page.
287 % \@fpmin :=L Minimum height of floats in a float column.
288 % It should also perform the following local assignments where necessary
289 % -- i.e., where the new value differs from the old one:
290 % \@fptop :=L \@dblfptop
291 % \@fpsep :=L \@dblfpsep
292 % \@fpbot :=L \@dblfpbot
293 %
294 % OUTPUT ROUTINE VARIABLES
295 %
296 % \@colht : The total height of the current column. In single column
297 % style, it equals \textheight. In two-column style, it is
298 % \textheight minus the height of the double-column floats
299 % on the current page. MUST BE INITIALIZED TO \textheight.
300 %
301 % \@colroom : The height available in the current column for text and
302 % footnotes. It equals \@colht minus the height of all
303 % floats committed to the top and bottom of the current
304 % column.
305 %
306 % \@textfloatsheight : The total height of in-text floats on the
307 % current page.
308 %
309 % \footins : Footnote insertion number.
310 %
311 % \@maxdepth : Saved value of TeX's \maxdepth. Must be set
312 % when any routine sets \maxdepth.
313 %
314 % CALLING THE OUTPUT ROUTINE
315 % --------------------------
316 %
317 % The output routine is called either by TeX's normal page-breaking
318 % mechanism, or by a macro putting a penalty < or = -10000 in the output
319 % list. In the latter case, the penalty indicates why the output
320 % routine was called, using the following code.
321 %
322 % penalty reason
323 % ------- ------
324 % -10000 \pagebreak
325 % \newpage
326 % -10001 \clearpage (\penalty -10000 \vbox{} \penalty -10001)
327 % -10002 float insertion, called from horizontal mode
328 % -10003 float insertion, called from vertical mode.
329 % -10004 float insertion.
330 %
331 % Note: A float or marginpar puts the following sequence in the output
332 % list: (i) a penalty of -10004,
333 % (ii) a null \vbox
334 % (iii) a penalty of -10002 or -10003.
335 % This solves two special problems:
336 % 1. If the float comes right after a \newpage or \clearpage,
337 % then the first penalty is ignored, but the second one
338 % invokes the output routine.
339 % 2. If there is a split footnote on the page, the second 'page'
340 % puts out the rest of the footnote.
341 %
342 % THE OUTPUT ROUTINE
343 % ------------------
344 %
345 % FUNCTIONS USED IN THE OUTPUT ROUTINE:
346 %
347 % \@outputpage : Produces an output page with the contents of box
348 % \@outputbox as the text part.
349 % Also sets \@colht :=G \textheight.
350 % The page style is determined as follows.
351 % IF @thispagestyle = true
352 % THEN use \thispagestyle style
353 % ELSE use ordinary page style.
354 %
355 % \@tryfcolumn\FLIST : Tries to form a float column composed of floats
356 % from \FLIST (if nonempty) with the following parameters:
357 % \@colht : height of box
358 % \@fpmin : minimum height of floats in the box
359 % \@fpsep : interfloat space
360 % \@fptop : glue at top of box
361 % \@fpbot : glue at bottom of box.
362 % If it succeeds, then it does the following:
363 % * \@outputbox :=L the composed float box.
364 % * @fcolmade :=G true
365 % * \FLIST :=G \FLIST - floats put in box
366 % * \@freelist :=G \@freelist + floats put in box
367 % If it fails, then:
368 % * @fcolmade :=G false
369 % NOTE: BIT MUST BE A SINGLE TOKEN!
370 %
371 % \@makefcolumn \FLIST : Same as \@tryfcolumn except that it
372 % fails to make a float column only if \FLIST is empty.
373 % Otherwise, it makes a float column containing at least
374 % the first box in \FLIST, disregarding \@fpmin.
375 %
376 % \@startcolumn :
377 % Calls \@tryfcolumn\@deferlist. If \@tryfcolumn returns with
378 % (globally set) @fcolmade = false, then:
379 % * Globally sets \@toplist and \@botlist to floats
380 % from \@deferlist to go at top and bottom of column,
381 % deleting them from \@deferlist. It does
382 % this using \@colht as the total height, the page
383 % style parameters \@floatsep and \@textfloatsep, and
384 % the float placement parameters \@topnum, \@toproom,
385 % \@botnum, \@botroom, \@colnum and \textfraction.
386 % * Globally sets \@colroom to \@colht minus the height
387 % of the added floats.
388 %
389 % \@startdblcolumn :
390 % Calls \@tryfcolumn\@dbldeferlist{8}. If \@tryfcolumn returns
391 % with (globally set) @fcolmade = false, then:
392 % * Globally sets \@dbltoplist to floats from
393 % \@dbldeferlist to go at top and bottom of column,
394 % deleting them from \@dbldeferlist.
395 % It does this using \textheight as the
396 % total height, and the parameters \@dblfloatsep, etc.
397 % * Globally sets \@colht to \textheight minus the height
398 % of the added floats.
399 %
400 % \@combinefloats : Combines the text from box
401 % \@outputbox with the floats from \@toplist and \@botlist,
402 % putting the new box in \@outputbox. It uses \floatsep
403 % and \textfloatsep for the appropriate separations.
404 % It puts the elements of \TOPLIST and \BOTLIST onto
405 % \@freelist, and makes those lists null.
406 %
407 % \@makecol : Makes the contents of \box255 plus the accumulated
408 % footnotes, plus the floats in \@toplist and \@botlist,
409 % into a single column of height \@colht (unless the page
410 % height has been locally changed), which it puts
411 % into box \@outputbox. It puts boxes in \@midlist back
412 % onto \@freelist and restores \maxdepth.
413 %
414 % \@opcol : Outputs a column whose text is in box \@outputbox
415 % If @twocolumn = false, then it calls \@outputpage,
416 % sets \@colht :=G \textheight, and calls \@floatplacement.
417 %
418 % If @twocolumn = true, then:
419 % If @firstcolumn = true, then it puts box \@outputbox
420 % into \@leftcolumn and sets @firstcolumn :=G false.
421 %
422 % If @firstcolumn = false, then it puts out the current
423 % two-column page, any possible two-column float pages,
424 % and determines \@dbltoplist for the next page.
425 %
426 %
427 %
428 % USER COMMANDS THAT CALL OR AFFECT THE OUTPUT ROUTINE
429 % ----------------------------------------------------
430 %
431 % \newpage == BEGIN \par\vfil\penalty -10000 END
432 %
433 % \clearpage == BEGIN \newpage
434 % \write -1{} % Part of hack to make sure no
435 % \vbox{} % \write's get lost.
436 % \penalty -10001
437 % END
438 %
439 % \cleardoublepage == BEGIN \clearpage
440 % if @twoside = true and c@page is even
441 % then \hbox{} \newpage fi
442 % END
443 %
444 %
445 % \twocolumn[BOX] : starts a new page, changing to twocolumn setting
446 % and puts BOX in a parbox of width \textwidth across the top.
447 % Useful for full-width titles for double-column pages.
448 % SURPRISE: The stretch from \@dbltextfloatsep will be inserted
449 % between the BOX and the top of the two columns.
450 %
451 %
452 % FLOAT-HANDLING MECHANISMS
453 % -------------------------
454 %
455 % The float environment obtains an insertion number B from the
456 % \@freelist (see below for a description of list manipulation), puts
457 % the float into box B and sets \count B to a FLOAT SPECIFIER. For
458 % a normal (not double-column) float, it then causes a page break
459 % in one of the following two ways:
460 % - In outer hmode: \vadjust{\penalty -10002}
461 % - In vmode : \penalty -10003.
462 % For a double-column float, it puts B onto the \@dbldeferlist.
463 % The float specifier has two components:
464 % * A PLACEMENT SPECIFICATION, describing where the float may
465 % be placed.
466 % * A TYPE, which is a power of two--e.g., figures might be
467 % type 1 floats, tables type 2 floats, programs type 4 floats, etc.
468 % The float specifier is encoded as follows, where bit 0 is the least
469 % significant bit.
470 %
471 % Bit Meaning
472 % --- -------
473 % 0 1 iff the float may go where it appears in the text.
474 % 1 1 iff the float may go on the top of a page.
475 % 2 1 iff the float may go on the bottom of a page.
476 % 3 1 iff the float may go on a float page.
477 % 4 1 unless the PLACEMENT includes a !
478 % 5 1 iff a type 1 float
479 % 6 1 iff a type 2 float
480 % etc.
481 %
482 % A negative float specifier is used to indicate a marginal note.
483 %
484 % MACROS AND DATA STRUCTURES FOR PROCESSING FLOATS
485 % ------------------------------------------------
486 %
487 % A FLOAT LIST consisting of the floats in boxes \boxa ... \boxN has
488 % the form:
489 % \@elt \boxa ... \@elt \boxN
490 % where \boxI is defined by
491 % \newinsert\boxI
492 % Normally, \@elt is \let to \relax. A test can be performed on the
493 % entire float list by locally \def'ing \@elt appropriately and
494 % executing the list.
495 % This is a lot more efficient than looping through the list.
496 %
497 % The following macros are used for manipulating float lists.
498 %
499 % \@next \CS \LIST {NONEMPTY}{EMPTY} == %% NOTE: ASSUME \@elt = \relax
500 % BEGIN assume that \LIST == \@elt \B1 ... \@elt \Bn
501 % if n = 0
502 % then EMPTY
503 % else \CS :=L \B1
504 % \LIST :=G \@elt \B2 ... \@elt \Bn
505 % NONEMPTY
506 % fi
507 % END
508 %
509 %
510 % \@bitor\NUM\LIST : Globally sets switch @test to the disjunction for
511 % all I of bit log2 \NUM of the float specifiers of all the
512 % floats in \LIST.
513 % I.e., @test is set to true iff there is at least one
514 % float in \LIST having bit log2 \NUM of its float specifier
515 % equal to 1.
516 %
517 % Note: log2 [(\count I)/32] is the bit number corresponding to the
518 % type of float I. To see if there is any float in \LIST having
519 % the same type as float I, you run \@bitor with
520 % \NUM = [(\count I)/32] * 32.
521 %
522 % \@bitor\NUM\LIST ==
523 % BEGIN
524 % @test :=G false
525 % { \@elt \CTR == if \NUM <> 0 then
526 % if \count\CTR / \NUM is odd
527 % then @test := true fi fi
528 % \LIST
529 % }
530 % END
531 %
532 %
533 % \@cons\LIST\NUM : Globally sets \LIST := \LIST * \@elt \NUM
534 %
535 % \@cons\LIST\NUM ==
536 % BEGIN { \@elt == \relax
537 % \LIST :=G \LIST \@elt \NUM
538 % }
539 %
540 % BOX LISTS FOR FLOAT-PLACEMENT ALGORITHMS
541 %
542 % \@freelist : List of empty boxes for placing new floats.
543 % \@toplist : List of floats to go at top of current column.
544 % \@midlist : List of floats in middle of current column.
545 % \@botlist : List of floats to go at bottom of current column.
546 % \@deferlist : List of floats to go after current column.
547 % \@dbltoplist : List of double-col. floats to go at top of current
548 % page.
549 % \@dbldeferlist : List of double-column floats to go on subsequent
550 % pages.
551 %
552 % FLOAT-PLACEMENT ALGORITHMS
553 %
554 %
555 % \@addtobot : Tries to put insert \@currbox on \@botlist.
556 % Called only when:
557 % * \ht BOX < \@colroom
558 % * type of \@currbox not on \@deferlist
559 % * \@colnum > 0
560 % * @insert = false
561 % If it succeeds, then:
562 % * sets @insert true
563 % * decrements \@botroom by \ht BOX
564 % * decrements \@botnum and \@colnum by 1
565 % * decrements \@colroom by \ht BOX + either \floatsep
566 % or \textfloatsep, as appropriate.
567 % * sets \maxdepth to 0pt % <-- as of 2025/06/01
568 % % no longer the case
569 %
570 % \@addtotoporbot : Tries to put insert \@currbox on \@toplist or
571 % \@botlist.
572 % Called only under same conditions as \@addtobot.
573 % If it succeeds, then:
574 % * sets @insert true
575 % * decrements \@toproom or \@botroom by \ht BOX
576 % * decrements \@colnum and either \@topnum or
577 % \@botnum by 1
578 % * decrements \@colroom by \ht BOX + \floatsep
579 % or \textfloatsep, as appropriate.
580 %
581 % \@addtocurcol : Tries to add \@currbox to current column, setting
582 % @insert true if it succeeds, false otherwise.
583 % It will add \@currbox to top only if bit 0 of
584 % \count \@currbox is 0, and to the bottom only if
585 % bit 0 = 0 or an earlier float of the same type is
586 % put on the bottom.
587 % If the float is put in the text, then
588 % \penalty\interlinepenalty is put
589 % right after the float, before the following \vskip,
590 % and \outputpenalty :=L 0.
591 %
592 % \@addtonextcol : Tries to add \@currbox to the next column, setting
593 % @insert true if it succeeds, false otherwise.
594 %
595 % \@addtodblcol : Tries to add \@currbox to the next double-column page,
596 % adding it to \@dbltoplist if it succeeds and
597 % \@dbldeferlist if it fails.
598 %
599 %
600 % \@addmarginpar ==
601 % BEGIN
602 % if \@currlist nonempty
603 % then remove \@marbox from \@currlist
604 % add \@marbox and \@currbox to \@freelist
605 % %% NOTE: \@currbox = left box
606 % else LaTeX error: ? %% shouldn't happen
607 % fi
608 % \@tempcnta := 1 %% 1 = right, -1 = left
609 % if @twocolumn = true
610 % then if @firstcolumn = true
611 % then \@tempcnta := -1
612 % fi
613 % else if @mparswitch = true
614 % then if count0 odd
615 % else \@tempcnta := -1
616 % fi
617 % fi
618 % if @reversemargin = true
619 % then \@tempcnta := -\@tempcnta
620 % fi
621 % fi
622 % if \@tempcnta < 0 then \box\@marbox :=G \box\@currbox
623 % fi
624 % \@tempdima :=L maximum(\@mparbottom - \@pageht
625 % + ht of \@marbox, 0)
626 % if \@tempdima > 0 then LaTeX warning: 'marginpar moved' fi
627 % \@mparbottom :=G \@pageht + \@tempdima + depth of \@marbox
628 % + \marginparpush
629 % \@tempdima :=L \@tempdima - ht of \@marbox
630 % \box\@marbox :=G \box\@currbox
631 % \vbox { \vskip \@tempdima
632 % \box\@marbox
633 % }
634 % height of \@marbox :=G depth of \@marbox :=G 0
635 % \kern -\@pagedp
636 % \nointerlineskip
637 % \hbox{ if @tempcnta > 0 then \hskip \columnwidth
638 % \hskip \marginparsep
639 % else \hskip -\marginparsep
640 % \hskip -\marginparwidth
641 % fi
642 % \box\@marbox \hss
643 % }
644 % \nobreak
645 % \nointerlineskip
646 % \hbox{\vrule height 0 width 0 depth \@pagedp}
647 % END
648 % \end{oldcomments}
649 %
650 %
651 %
652 % \subsection{Core definitions}
653 %
654 % Floats and marginpars add a lot of dead cycles.
655 % \begin{macrocode}
656 \maxdeadcycles = 100
657 % \end{macrocode}
658 %
659 % \begin{macrocode}
660 \let\@elt\relax
661 % \end{macrocode}
662 %
663 % \begin{macrocode}
664 \def\@next#1#2#3#4{\ifx#2\@empty #4\else
665 \expandafter\@xnext #2\@@#1#2#3\fi}
666 % \end{macrocode}
667 %
668 % \begin{macrocode}
669 \def\@xnext \@elt #1#2\@@#3#4{\def#3{#1}\gdef#4{#2}}
670 % \end{macrocode}
671 %
672 % \changes{v1.1v}{1996/07/26}{put \cs{global} into definition}
673 % \begin{macrocode}
674 \def\@testfalse{\global\let\if@test\iffalse}
675 \def\@testtrue {\global\let\if@test\iftrue}
676 \@testfalse
677 % \end{macrocode}
678 %
679 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
680 % \begin{macrocode}
681 \def\@bitor#1#2{\@testfalse {\let\@elt\@xbitor
682 \@tempcnta #1\relax #2}}
683 % \end{macrocode}
684 % RmS 91/11/22: Added test for |\count#1 = 0|.
685 % Suggested by Chris Rowley.
686 %
687 %
688 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
689 % \begin{macrocode}
690 \def\@xbitor #1{\@tempcntb \count#1
691 \ifnum \@tempcnta =\z@
692 \else
693 \divide\@tempcntb\@tempcnta
694 \ifodd\@tempcntb \@testtrue\fi
695 \fi}
696 % \end{macrocode}
697 %
698 %
699 % \subsubsection{Definition of float boxes}
700 %
701 %
702 % \changes{v1.3a}{2015/09/205}
703 % {extended \cs{@freelist}}
704 % \changes{v2.3m}{2025/04/14}{Always use extended free list}
705 % \begin{macrocode}
706 \let\@elt\newinsert
707 \def\@freelist{%
708 \@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
709 \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
710 \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
711 \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R}
712 \@freelist
713 \def\reserved@a{%
714 \@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
715 \@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
716 \@elt\bx@AA\@elt\bx@BB\@elt\bx@CC\@elt\bx@DD\@elt\bx@EE
717 \@elt\bx@FF\@elt\bx@GG\@elt\bx@HH\@elt\bx@II\@elt\bx@JJ
718 \@elt\bx@KK\@elt\bx@LL\@elt\bx@MM\@elt\bx@NN
719 \@elt\bx@OO\@elt\bx@PP\@elt\bx@QQ\@elt\bx@RR
720 \@elt\bx@SS\@elt\bx@TT\@elt\bx@UU\@elt\bx@VV
721 \@elt\bx@WW\@elt\bx@XX\@elt\bx@YY\@elt\bx@ZZ}
722 \reserved@a
723 \def\@elt{\noexpand\@elt\noexpand}
724 \edef\@freelist{\@freelist\reserved@a}
725 \let\reserved@a\relax
726 \let\@elt\relax
727 % \end{macrocode}
728 %
729 % \begin{macrocode}
730 \gdef\@toplist{}
731 \gdef\@botlist{}
732 \gdef\@midlist{}
733 \gdef\@currlist{}
734 \gdef\@deferlist{}
735 \gdef\@dbltoplist{}
736 % \end{macrocode}
737 % \changes{v1.2m}{2015/03/12}
738 % {initialise \cs{@dbldeferlist} again}
739 % The new algorithm stores page wide floats together with column floats
740 % in a single |\@deferlist| list. We keep |\@dbldeferlist|
741 % initialised as empty so that packages that are testing for
742 % deferred floats can use the same code for old or new float
743 % handling.
744 % \begin{macrocode}
745 \gdef\@dbldeferlist{}
746 % \end{macrocode}
747 %
748 %
749 %
750 % \subsubsection{Page layout parameters}
751 %
752 %
753 % \begin{macrocode}
754 \newdimen\topmargin
755 \newdimen\oddsidemargin
756 \newdimen\evensidemargin
757 \let\@themargin=\oddsidemargin
758 \newdimen\headheight
759 \newdimen\headsep
760 \newdimen\footskip
761 \newdimen\textheight
762 \newdimen\textwidth
763 \newdimen\columnwidth
764 \newdimen\columnsep
765 \newdimen\columnseprule
766 \newdimen\marginparwidth
767 \newdimen\marginparsep
768 \newdimen\marginparpush
769 % \end{macrocode}
770 %
771 % \begin{macro}{\AtBeginDvi}
772 % \changes{v1.1c}{1994/11/05}
773 % {Added macro}
774 % \begin{macro}{\@begindvibox}
775 % \changes{v1.1c}{1994/11/05}
776 % {Added macro}
777 % \changes{v1.1f}{1994/11/14}{Use normal box register: why a box?}
778 % \changes{v1.1l}{1995/04/24}{Add \cs{vbox} latex/1392}
779 % \changes{v1.4e}{2019/08/27}{Make \cs{AtBeginDvi} robust}
780 %
781 % We use a box register in which to put
782 % stuff that must appear before anything else in the
783 % |.dvi| file.
784 %
785 % The stuff in the box should not add any typeset material to the
786 % page when it is unboxed.
787 %
788 % This interface is no longer used. Instead a new one is inside
789 % \texttt{ltshipout.dtx}. We only keep the box in case some old
790 % code refers to it directly (or we do some rollback).
791 % \changes{v1.4f}{2020/08/21}{Integration of new hook management interface}
792 % \begin{macrocode}
793 \newbox\@begindvibox
794 %\DeclareRobustCommand \AtBeginDvi [1]{%
795 % \global \setbox \@begindvibox
796 % \vbox{\unvbox \@begindvibox #1}%
797 %}
798 % \end{macrocode}
799 % \end{macro}
800 % \end{macro}
801 %
802 % \begin{macro}{\@maxdepth}
803 % This is not the right place to set this; it needs to be set in a
804 % class/style file when |\maxdepth| is set.
805 %
806 % Also, many settings to |\maxdepth| should be to |\@maxdepth|,
807 % probably?
808 % \task{All}{Sort out maxdepth: both should be set in the class files.}
809 % \begin{macrocode}
810 \newdimen\@maxdepth
811 \@maxdepth = \maxdepth
812 % \end{macrocode}
813 % \end{macro}
814 % \begin{macro}{\paperheight}
815 % \changes{v0.1a}{1993/11/23}{Register added}
816 % \begin{macro}{\paperwidth}
817 % \changes{v0.1a}{1993/11/23}{Register added}
818 % New |\paper|\ldots\ registers.
819 % \begin{macrocode}
820 \newdimen\paperheight
821 \newdimen\paperwidth
822 % \end{macrocode}
823 % \end{macro}
824 % \end{macro}
825 % \begin{macro}{\stockheight}
826 % \changes{v1.4j}{2022/08/20}{Register added}
827 % \begin{macro}{\stockwidth}
828 % \changes{v1.4j}{2022/08/20}{Register added}
829 % New |\stock|\ldots\ registers.
830 % \begin{macrocode}
831 \newdimen\stockheight
832 \newdimen\stockwidth
833 % \end{macrocode}
834 % \end{macro}
835 % \end{macro}
836 %
837 % \begin{macro}{\if@insert}
838 % \begin{macro}{\if@fcolmade}
839 % \begin{macro}{\if@specialpage}
840 % \begin{macro}{\if@firstcolumn}
841 % \begin{macro}{\if@twocolumn}
842 % \begin{macro}{\if@twoside}
843 % \begin{macro}{\if@reversemargin}
844 % \begin{macro}{\if@mparswitch}
845 % \begin{macro}{\col@number}
846 % \changes{v1.0n}{1994/04/30}{Added \cs{col@number}}
847 % Local switches first:
848 % \begin{macrocode}
849 \newif \if@insert
850 % \end{macrocode}
851 % These should definitely be global:
852 % \begin{macrocode}
853 \newif \if@fcolmade
854 \newif \if@specialpage \@specialpagefalse
855 % \end{macrocode}
856 % These should be global but are not always set globally in other
857 % files.
858 % \begin{macrocode}
859 \newif \if@firstcolumn \@firstcolumntrue
860 \newif \if@twocolumn \@twocolumnfalse
861 % \end{macrocode}
862 % Not sure about these: two questions.
863 % Should things which must apply to a whole document be local or
864 % global (they probably should be `preamble only' commands)?
865 % Are these three such things?
866 % \begin{macrocode}
867 \newif \if@twoside \@twosidefalse
868 \newif \if@reversemargin \@reversemarginfalse
869 \newif \if@mparswitch \@mparswitchfalse
870 % \end{macrocode}
871 % This counter has been imported from `multicol'.
872 % \begin{macrocode}
873 \newcount \col@number
874 \col@number \@ne
875 % \end{macrocode}
876 % \end{macro}
877 % \end{macro}
878 % \end{macro}
879 % \end{macro}
880 % \end{macro}
881 % \end{macro}
882 % \end{macro}
883 % \end{macro}
884 % \end{macro}
885 %
886 %
887 %
888 %
889 % \subsubsection{Internal registers}
890 %
891 %
892 %
893 % \begin{macrocode}
894 \newcount\@topnum
895 \newdimen\@toproom
896 \newcount\@dbltopnum
897 \newdimen\@dbltoproom
898 \newcount\@botnum
899 \newdimen\@botroom
900 \newcount\@colnum
901 \newdimen\@textmin
902 \newdimen\@fpmin
903 \newdimen\@colht
904 \newdimen\@colroom
905 \newdimen\@pageht
906 \newdimen\@pagedp
907 \newdimen\@mparbottom \@mparbottom\z@
908 \newcount\@currtype
909 \newbox\@outputbox
910 \newbox\@leftcolumn
911 \newbox\@holdpg
912 % \end{macrocode}
913 %
914 % \begin{macrocode}
915 \def\@thehead{\@oddhead} % initialization
916 \def\@thefoot{\@oddfoot}
917 % \end{macrocode}
918 %
919 %
920 %
921 %
922 % \subsubsection{Page break commands}
923 %
924 % \begin{macro}{\clearpage}
925 % \changes{v1.1r}{1995/10/11}{Added a check so that it does not lose
926 % the argument of \cs{twocolumn[...]}}
927 %
928 % The tests at the beginning are an experimental attempt to avoid a
929 % completely empty page after a |\twocolumn[...]|. This prevents the
930 % text from the argument vanishing into a float box, never to be seen
931 % again. We hope that it does not produce wrong formatting in other
932 % cases.
933 % \changes{v1.1v}{1996/07/26}{add number of missing percents}
934 % \begin{macrocode}
935 \def\clearpage{%
936 \ifvmode
937 \ifnum \@dbltopnum =\m@ne
938 \ifdim \pagetotal <\topskip
939 \hbox{}%
940 \fi
941 \fi
942 \fi
943 \newpage
944 % \end{macrocode}
945 %
946 % After the above \cs{newpage} there may be some still unwritten
947 % \cs{write}'s issued in the output routine and we need to make
948 % sure that they are not lost when \cs{@doclearpage} produces float
949 % pages. Therefore the following trick is applied: We add a
950 % harmless \cs{write} followed by an empty \cs{vbox} and then call
951 % the output routine again through a special penalty. That
952 % triggers \cs{@doclearpage} in the OR which splits off a
953 % zero-sized chunk from box 255 (which should go up to, but not
954 % including, the \cs{vbox}), then \cs{unvbox} that (which should
955 % contain any \cs{write}'s, and then throw away the rest of 255
956 % (which should just contain the \cs{vbox}). That explains the
957 % strange \cs{write}\texttt{-1\{\}}: that statement introduces a
958 % necessary breakpoint so that the split is done before the
959 % \cs{vbox}. If it would not be there and \emph{there are no real
960 % \cs{write}'s}, then the split would grab the whole of 255 and so
961 % would put the \cs{vbox} back on the page and we would end with an
962 % extra page only containing that empty \cs{vbox}.
963 %
964 % Deep breath---the above is my (Frank's) attempt of a slightly longer
965 % version of Leslie's cryptic comment earlier in the file that
966 % this \cs{write} is \enquote{part of a hack to make sure that no
967 % \cs{write}'s are lost}.
968 %
969 % This \cs{write} needs to be non-immediate even if we are
970 % supposedly already past the last page because it has to end up on
971 % the page sent to the output routine if for some reason that
972 % happens.
973 % \changes{v1.4p}{2025/03/05}{Make sure this is a normal write in all
974 % circumstances}
975 % \begin{macrocode}
976 \@@write\m@ne{}%
977 \vbox{}%
978 \penalty -\@Mi
979 }
980 % \end{macrocode}
981 %
982 % \changes{v1.4p}{2025/03/05}{A \LaTeXe{} name for \cs{write} in case
983 % it gets changed after the last page}
984 % \begin{macrocode}
985 \let\@@write\write
986 % \end{macrocode}
987 % \end{macro}
988 %
989 % \begin{macro}{\cleardoublepage}
990 %
991 % \begin{macrocode}
992 \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
993 \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
994 %</2ekernel>
995 % \end{macrocode}
996 % \end{macro}
997 %
998 % \begin{macro}{\onecolumn}
999 % \changes{v1.0n}{1994/04/30}{Added setting of \cs{col@number}}
1000 % \begin{macrocode}
1001 %<*2ekernel|fltrace>
1002 \def\onecolumn{%
1003 \clearpage
1004 \global\columnwidth\textwidth
1005 \global\hsize\columnwidth
1006 \global\linewidth\columnwidth
1007 \global\@twocolumnfalse
1008 \col@number \@ne
1009 \@floatplacement}
1010 % \end{macrocode}
1011 % \end{macro}
1012 %
1013 % \begin{macro}{\newpage}
1014 % \changes{v1.1x}{1996/09/29}{Checks for noskipsec and inlabel added}
1015 % \changes{v1.1x}{1996/09/29}{Checks for noskipsec and inlabel added}
1016 % \changes{v1.1y}{1996/09/30}{Checks for noskipsec and inlabel removed
1017 % pending further tests}
1018 % \changes{v1.1z}{1996/10/24}{Better checks for noskipsec and
1019 % inlabel added, plus nobreak}
1020 % \changes{v1.2a}{1996/10/25}{Reset all flags explicitly}
1021 % \changes{v2.4a}{2017/04/11}{account for the depth of the last row of the page}
1022 % The two checks at the beginning ensure that an item label or
1023 % run-in section title immediately before a |\newpage| get printed
1024 % on the correct page, the one before the page break.
1025 %
1026 % All three tests are largely to make error processing more robust;
1027 % that is why they all reset the flags explicitly, even when it
1028 % would appear that this would be done by a |\leavevmode|.
1029 % \begin{macrocode}
1030 %</2ekernel|fltrace>
1031 %<latexrelease>\IncludeInRelease{2025/06/01}%
1032 %<latexrelease> {\newpage}{Check depth of page}%
1033 %<*2ekernel|latexrelease|fltrace>
1034 \def \newpage {%
1035 \if@noskipsec
1036 \ifx \@nodocument\relax
1037 \leavevmode
1038 \global \@noskipsecfalse
1039 \fi
1040 \fi
1041 \if@inlabel
1042 \leavevmode
1043 \global \@inlabelfalse
1044 \fi
1045 \if@nobreak \@nobreakfalse \everypar{}\fi
1046 % \end{macrocode}
1047 % The |\vfil| at the end of the macro before the break penalty will
1048 % normally result in the page being run short, even with |\flushbottom|
1049 % in effect (in contrast to the behavior
1050 % of |\pagebreak|). However, if there
1051 % is some explicit stretch on the page, say, a |\vfill|, it has the undesired
1052 % side-effect, that the last line will not align at its baseline if it
1053 % contains characters going below the baseline, as the value of |\prevdepth|
1054 % is no longer taken into account by \TeX{}. So we have to back up by that amount
1055 % (or by |\maxdepth| if it is really huge), to mimic the normal behavior
1056 % without the |\newpage|.
1057 %
1058 % In 2017 this was fixed by doing the backing-up here. However, the
1059 % problem with that is that if the page contains footnotes the
1060 % \cs{skip}\cs{\footins} is measured from the baseline of the last
1061 % line and not (as on all other pages) from the bottom of the last
1062 % line. One can argue that measuring from the baseline is better,
1063 % but if that is done it should be done everywhere not just on some
1064 % pages.
1065 %
1066 % Thus this backing up should only happen when there are no
1067 % footnotes. The problem is that, at the point when \cs{newpage} is
1068 % called, it is not known whether or not there are footnotes;
1069 % that is only determined in the output routine. We have therefore
1070 % moved this code to the newly introduced output routine sockets.
1071 % \changes{v1.4q}{2025/03/20}{Remove skip added in 2.4a (footmisc/19)}
1072 %
1073 % An explicit \cs{par} token is required so that after environments
1074 % like lists \cs{par} is reset to its standard meaning and does not
1075 % suppress indentation on the next page.
1076 % \changes{v1.4x}{2025/04/13}{reinserted par token (github/1712)}
1077 % \begin{macrocode}
1078 \par
1079 % \ifdim\prevdepth>\z@
1080 % \vskip -%
1081 % \ifdim\prevdepth>\maxdepth
1082 % \maxdepth
1083 % \else
1084 % \prevdepth
1085 % \fi
1086 % \fi
1087 \vfil
1088 \penalty -\@M}
1089 %</2ekernel|latexrelease|fltrace>
1090 %<latexrelease>\EndIncludeInRelease
1091 % \end{macrocode}
1092 %
1093 % \begin{macrocode}
1094 %<latexrelease>\IncludeInRelease{2017/04/15}%
1095 %<latexrelease> {\newpage}{Check depth of page}%
1096 %<latexrelease>\def \newpage {%
1097 %<latexrelease> \if@noskipsec
1098 %<latexrelease> \ifx \@nodocument\relax
1099 %<latexrelease> \leavevmode
1100 %<latexrelease> \global \@noskipsecfalse
1101 %<latexrelease> \fi
1102 %<latexrelease> \fi
1103 %<latexrelease> \if@inlabel
1104 %<latexrelease> \leavevmode
1105 %<latexrelease> \global \@inlabelfalse
1106 %<latexrelease> \fi
1107 %<latexrelease> \if@nobreak \@nobreakfalse \everypar{}\fi
1108 %<latexrelease> \par
1109 %<latexrelease> \ifdim\prevdepth>\z@
1110 %<latexrelease> \vskip -%
1111 %<latexrelease> \ifdim\prevdepth>\maxdepth
1112 %<latexrelease> \maxdepth
1113 %<latexrelease> \else
1114 %<latexrelease> \prevdepth
1115 %<latexrelease> \fi
1116 %<latexrelease> \fi
1117 %<latexrelease> \vfil
1118 %<latexrelease> \penalty -\@M}
1119 % \end{macrocode}
1120 %
1121 % \begin{macrocode}
1122 %<latexrelease>\EndIncludeInRelease
1123 %<latexrelease>\IncludeInRelease{0000/00/00}%
1124 %<latexrelease> {\newpage}{Check depth of page}%
1125 %<latexrelease>\def \newpage {%
1126 %<latexrelease> \if@noskipsec
1127 %<latexrelease> \ifx \@nodocument\relax
1128 %<latexrelease> \leavevmode
1129 %<latexrelease> \global \@noskipsecfalse
1130 %<latexrelease> \fi
1131 %<latexrelease> \fi
1132 %<latexrelease> \if@inlabel
1133 %<latexrelease> \leavevmode
1134 %<latexrelease> \global \@inlabelfalse
1135 %<latexrelease> \fi
1136 %<latexrelease> \if@nobreak \@nobreakfalse \everypar{}\fi
1137 %<latexrelease> \par
1138 %<latexrelease> \vfil
1139 %<latexrelease> \penalty -\@M}
1140 %<latexrelease>\EndIncludeInRelease
1141 %<*2ekernel|fltrace>
1142 % \end{macrocode}
1143 % \end{macro}
1144 %
1145 % \begin{macro}{\@emptycol}
1146 % \changes{v1.0n}{1994/04/30}{Empty column action added:
1147 % \cs{@emptycol}}
1148 % It may be better to use an invisible rule rather than an empty
1149 % box here.
1150 % \begin{macrocode}
1151 \def \@emptycol {\vbox{}\penalty -\@M}
1152 % \end{macrocode}
1153 % \end{macro}
1154 %
1155 % \begin{macro}{\twocolumn}
1156 % \begin{macro}{\@topnewpage}
1157 % \changes{v1.0f}{1993/12/05}{Commands changed}
1158 % \changes{v1.0g}{1993/12/06}{\cs{@floatplacement} placement bug
1159 % fixed}
1160 % \changes{v1.0j}{1993/12/17}{check for vsize too small added}
1161 % \changes{v1.2c}{1997/11/09}{Documentation of vsize check enhanced}
1162 % There are several bug fixes to the two-column stuff here.
1163 %
1164 % \changes{v1.0n}{1994/04/30}{Added setting of \cs{col@number}}
1165 % \begin{macrocode}
1166 \def \twocolumn {%
1167 \clearpage
1168 \global\columnwidth\textwidth
1169 \global\advance\columnwidth-\columnsep
1170 \global\divide\columnwidth\tw@
1171 \global\hsize\columnwidth
1172 \global\linewidth\columnwidth
1173 \global\@twocolumntrue
1174 \global\@firstcolumntrue
1175 \col@number \tw@
1176 % \end{macrocode}
1177 % There is no reason to put a |\@dblfloatplacement| here since
1178 % |\@topnewpage| ignores these settings.
1179 % The |\@floatplacement| is needed in case this comes after some
1180 % changes.
1181 % \changes{v1.0h}{1993/12/12}{braces removed}
1182 % \begin{macrocode}
1183 \@ifnextchar [\@topnewpage\@floatplacement
1184 }
1185 % \end{macrocode}
1186 %
1187 % Note that here, getting a box from the freelist can assume
1188 % success since this comes just after a |\clearpage|.
1189 % \changes{v1.0n}{1994/04/30}{Added setting of \cs{col@number}}
1190 % \changes{v1.1a}{1994/10/31}
1191 % {(DPC/CAR) Use \cs{color@begingroup} for colour}
1192 % \changes{v1.1a}{1994/10/31}
1193 % {(DPC/CAR) Use \cs{normalcolor}}
1194 % \changes{v1.1a}{1994/10/31}
1195 % {(DPC/CAR) Extra box added to remove colour resetting from vmode}
1196 % \changes{v1.1b}{1994/11/05}
1197 % {Use new \cs{color@hbox} concept.}
1198 % \changes{v1.1i}{1994/11/21}{Changed to \cs{color@vbox}}
1199 % \changes{v1.1z}{1996/10/24}{Added \cs{@nodocument} to trap
1200 % \cs{twocolumn} in the preamble}
1201 % \begin{macrocode}
1202 \long\def \@topnewpage [#1]{%
1203 \@nodocument
1204 \@next\@currbox\@freelist{}{}%
1205 \global \setbox\@currbox
1206 \color@vbox
1207 \normalcolor
1208 \vbox {%
1209 \hsize\textwidth
1210 \@parboxrestore
1211 \col@number \@ne
1212 #1%
1213 \vskip -\dbltextfloatsep
1214 }%
1215 \color@endbox
1216 % \end{macrocode}
1217 % Added size test and warning message; perhaps we should use
1218 % an error message.
1219 % \changes{v1.0l}{1994/03/15}{Corrected and amended warning message}
1220 % \changes{v1.0m}{1994/04/24}{Warning message removed as it will be
1221 % generated later}
1222 % \begin{macrocode}
1223 \ifdim \ht\@currbox>\textheight
1224 \ht\@currbox \textheight
1225 \fi
1226 % \end{macrocode}
1227 % This next line is not essential but it is more robust to make this
1228 % value non-zero, in case of weird errors.
1229 %
1230 % This next bit is what is needed from |\@addtodblcol|, plus some
1231 % extra checks for error trapping.
1232 % \begin{macrocode}
1233 \global \count\@currbox \tw@
1234 \@tempdima -\ht\@currbox
1235 \advance \@tempdima -\dbltextfloatsep
1236 \global \advance \@colht \@tempdima
1237 \ifx \@dbltoplist \@empty
1238 \else
1239 \@latex@error{Float(s) lost}\@ehb
1240 \let \@dbltoplist \@empty
1241 \fi
1242 \@cons \@dbltoplist \@currbox
1243 % \end{macrocode}
1244 % This setting of |\@dbltopnum| is used only to change the
1245 % typesetting in\\ |\@combinedblfloats|.
1246 % \begin{macrocode}
1247 \global \@dbltopnum \m@ne
1248 %<*trace>
1249 \fl@trace{dbltopnum set to -1 (= \the \@dbltopnum) (topnewpage)}%
1250 %</trace>
1251 % \end{macrocode}
1252 % At points such as this we need to check that there is still a
1253 % minimal amount of room left on the page; this uses an arbitrary
1254 % small value at present; but note that this value is larger than
1255 % that used when checking that page is too full of normal floats.
1256 %
1257 % If there is little room left we just force a page-break, OK?
1258 % This involves producing two empty columns. The second empty
1259 % column may be produced by |\output|, in which case an extra,
1260 % misleading, warning will be generated, OK? (This happens only
1261 % when there is too little room left on the page for any float.)
1262 % Otherwise (\ie if the size is such that it is allowed as a normal
1263 % float) the extra |\@emptycol| will be invoked in the second
1264 % column by the conditional code guarded by the |\if@firstcolumn|
1265 % test.
1266 %
1267 % I now think that the cut-off point here should be |3\baselineskip|,
1268 % but we make it a bit less so that 3 lines of text will be
1269 % allowed, OK?
1270 %
1271 % Since this happens only when there is nothing on the page but the
1272 % `top-box', the empty box should not cause any problem other than
1273 % some overfull box messages, which is not entirely misleading.
1274 %
1275 % Here we need two page-ends since both columns need to be empty.
1276 % \task{???}{Make it less arbitrary?}
1277 % \changes{v1.0j}{1993/12/17}{Page room test added}
1278 % \changes{v1.0l}{1994/03/15}{Warning added: it should be improved}
1279 % \changes{v1.0m}{1994/04/24}{Message changed to give more info}
1280 % \changes{v1.0n}{1994/04/30}{Message changed for Frank}
1281 % \changes{v1.0n}{1994/04/30}{Empty column action added:
1282 % \cs{@emptycol}}
1283 % \changes{v1.0n}{1994/04/30}{Cut-off point changed to
1284 % 3\cs{baselineskip}}
1285 % \changes{v1.1t}{1996/05/24}{Cut-off point changed to
1286 % 2.5\cs{baselineskip}}
1287 % \begin{macrocode}
1288 \ifdim \@colht<2.5\baselineskip
1289 \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
1290 too tall on page \thepage}%
1291 \@emptycol
1292 \if@firstcolumn
1293 \else
1294 \@emptycol
1295 \fi
1296 \else
1297 \global \vsize \@colht
1298 \global \@colroom \@colht
1299 \@floatplacement
1300 \fi
1301 }
1302 % \end{macrocode}
1303 % \end{macro}
1304 % \end{macro}
1305 %
1306 %
1307 %
1308 % \section{The \LaTeX{} output routine}
1309 %
1310 % \subsection{Hooks and replaceable code blocks}
1311 %
1312 % To support packages that want to augment aspects of the output
1313 % routine we offer a number of hooks (where several packages can
1314 % add code) as well as some sockets (that can only be changed by
1315 % one package or through options like those of the \pkg{footmisc}
1316 % package).
1317 %
1318 %
1319 % \subsubsection{Output routine hooks}
1320 %
1321 % \begin{description}
1322 %
1323 % \item[\hook{build/page/before}, \hook{build/page/after}]
1324 % These two hooks enable packages to prepend or append code to
1325 % the page processing in the output routine. They are
1326 % implemented as mirrored hooks.
1327 %
1328 % Technically, they are executed at the start and the end of the internal
1329 % \LaTeXe{} \cs{@outputpage} command, respectively.
1330 %
1331 %
1332 % \item[\hook{build/page/reset}]
1333 % Packages that set up special conventions for text in the main
1334 % galley (such as catcode changes, etc.)\ can use this hook to
1335 % undo these changes within the output routine, so that they
1336 % aren't applied to unrelated material, e.g., the text for
1337 % running header or footers.
1338 %
1339 % \item[\hook{build/column/before}, \hook{build/column/after}]
1340 % These two hooks enable packages to prepend or append code to
1341 % the column processing in the output routine. They are
1342 % implemented as mirrored hooks.
1343 %
1344 % Technically, they are executed at the start and the end of the internal
1345 % \LaTeXe{} \cs{@makecol} command, respectively.
1346 %
1347 % \end{description}
1348 %
1349 % \subsubsection{Replaceable code blocks (sockets)}
1350 %
1351 % To cater for different layouts with respect to text, footnotes,
1352 % and bottom-floats placements there are sockets for
1353 % now. They are sockets not hooks, because the overall layout can only be
1354 % controlled by one package, i.e., the last setting wins.
1355 %
1356 % \begin{description}
1357 % \item[\socket{build/column/outputbox} (0 arguments)]
1358 %
1359 % In code for this socket the \cs{@outputbox} (holding the
1360 % galley text for the current column or page) is augmented by
1361 % attaching floats and footnote areas together with appropriate
1362 % spacing.
1363 %
1364 % Prior to calling the socket the output routine has already
1365 % decided which floats go into which area and which get deferred.
1366 % Therefore, the assumption is that the code in the socket attaches all
1367 % areas that contain floats. If this is not done, then the order
1368 % of floats is likely to be screwed up unless unused floats
1369 % are moved to the defer list in an appropriate way (for now we
1370 % don't offer any interface for that scenario).
1371 %
1372 % Before the code in the socket is run, any existing glue at the bottom
1373 % of the \cs{@outputbox} is removed and stored in a safe
1374 % place. If needed, it can be reinserted with one of the helper
1375 % commands.
1376 %
1377 % To support setting this up the following helper commands are available:
1378 % \begin{description}
1379 % \item[\cs{@outputbox@append} (1 argument)]
1380 %
1381 % \DescribeMacro[noprint]{@outputbox@append}
1382 %
1383 % This general purpose command alters the \cs{@outputbox} box by
1384 % appending material to it.
1385 %
1386 % \item[\cs{@outputbox@appendfil} (0 arguments)]
1387 %
1388 % Append a \cs{vfil} to the \cs{@outputbox}. Based on the plug
1389 % in \socket{build/column/baselineattach} either measured from
1390 % the bottom or from the baseline of the last line in the box.
1391 %
1392 % \item[\cs{@outputbox@appendfootnotes} (0 arguments)]
1393 %
1394 % \DescribeMacro[noprint]{@outputbox@appendfootnotes}
1395 %
1396 % This command appends the footnotes to the \cs{@outputbox} (if
1397 % there are any). If not, then it does nothing.
1398 %
1399 % \item[\cs{@outputbox@attachfloats} (0 arguments)]
1400 % \item[\cs{@outputbox@attachtopfloats} (0 arguments)]
1401 % \item[\cs{@outputbox@attachbottomfloats} (0 arguments)]
1402 %
1403 % \DescribeMacro[noprint]{@outputbox@attachfloats}
1404 % \DescribeMacro[noprint]{@outputbox@attachtopfloats}
1405 % \DescribeMacro[noprint]{@outputbox@attachbottomfloats}
1406 %
1407 % Attaching top and bottom floats can usually be done in one
1408 % go, but for special layouts we might want more control so we
1409 % provide also separate commands.
1410 %
1411 % \item[\cs{@outputbox@reinsertbskip} (0 arguments)]
1412 %
1413 % \DescribeMacro[noprint]{@outputbox@reinsertbskip}
1414 %
1415 % Reinsert the bottom skip of the \cs{@outputbox} that was
1416 % saved before in \cs{@makecol}.
1417 %
1418 % \item[Testing for existence of material]
1419 %
1420 % \DescribeMacro[noprint]{@if@footnotes@TF}
1421 % \DescribeMacro[noprint]{@if@bottomfloats@TF}
1422 %
1423 % There are a number of helpers to run conditional code
1424 % depending on whether or not there are footnotes or bottom
1425 % floats. They are \cs{@if@footnotes@TF} and
1426 % \cs{@if@bottomfloats@TF}
1427 % (names are likely to change).
1428 %
1429 % \end{description}
1430 %
1431 % \task{fmi}{Decide on names for these helper commands. We could keep
1432 % them similar to the above (because they are only supposed to be
1433 % used by a few packages). However, we could alternatively use
1434 % CamelCase names, under the assumption that classes may also
1435 % directly define a plug for the socket, instead of loading a
1436 % support package such as \pkg{footmisc} (or in addition
1437 % to). --- decide}
1438 %
1439 % This socket cannot be empty but needs appropriate code; a set
1440 % of suitable plugs for it are already given in the kernel. These
1441 % are
1442 % \begin{description}
1443 % \item[\plug{space-footnotes-floats}]
1444 %
1445 % After the galley text there is a vertical \cs{vfil}
1446 % followed by any footnotes followed by the bottom floats, if any.
1447 %
1448 % \item[\plug{footnotes-space-floats}]
1449 %
1450 % As before but the \cs{vfil} is between footnotes and floats.
1451 %
1452 % \item[\plug{floats-space-footnotes}]
1453 %
1454 % Floats are directly after the text, then a space and then
1455 % footnotes at the bottom.
1456 %
1457 % \item[\plug{space-floats-footnotes}]
1458 %
1459 % Both floats and footnotes are pushed to the bottom with
1460 % footnotes last.\footnote{There are two more permutations,
1461 % but neither of them has ever been requested so they aren't
1462 % set up by default --- doing that in a class would be trivial
1463 % though.}
1464 %
1465 % \item[\plug{floats-footnotes}]
1466 %
1467 % All excess space is distributed across the existing
1468 % glue on the page, e.g., within the text galley, the
1469 % separation between blocks, etc.
1470 % The order is text, floats, footnotes.
1471 %
1472 % \item[\plug{footnotes-floats}]
1473 %
1474 % As the previous one but floats and footnotes are
1475 % swapped. This is the \LaTeX{} default for newer document,
1476 % i.e., this plug is assigned to the socket when
1477 % \cs{DocumentMetadata} is used.
1478 %
1479 % \item[\plug{footnotes-floats-legacy}]
1480 %
1481 % As the previous one but \LaTeX{}'s bottom skip bug is not
1482 % corrected, i.e., in ragged bottom designs where footnotes
1483 % are supposed to be directly attached to the text, they suddenly
1484 % appear at the bottom of the page when the page is ended with
1485 % \cs{newpage} or \cs{clearpage}.
1486 % While this is clearly a bug, it was the case since the days
1487 % of \LaTeX~2.09; thus for
1488 % compatibility we continue to support this behavior.
1489 %
1490 % \end{description}
1491 %
1492 %
1493 % \item[\socket{build/column/footnotes} (0 arguments)]
1494 %
1495 % This socket is used to manipulate the footnote
1496 % material inside \cs{box}\cs{footins}. It if contains code, it
1497 % is supposed to do some processing of that box and then write
1498 % the result back into it (and nothing else!). By default it
1499 % does nothing, i.e., has the \plug{noop} assigned.
1500 %
1501 % If (short) footnotes are run as a paragraph this socket gets
1502 % the plug \plug{para} assigned which is defined elsewhere.
1503 %
1504 % \item[\socket{build/column/baselineattach} (0 arguments)]
1505 %
1506 % By default, footnotes are attached after the last line of text
1507 % by adding a \cs{vskip}\cs{skip}\cs{footins}, i.e., the space
1508 % is measured from the bottom of \cs{@outputbox} (plug
1509 % \plug{off}). Bottom floats are attached in a similar way by
1510 % using \cs{vskip}\cs{textfloatsep}.
1511 %
1512 % The socket can get the plug \plug{on} assigned, in which case
1513 % the skip starts at the baseline of the last line in
1514 % \cs{@outputbox}, if there is one; otherwise it starts still
1515 % from the bottom of the box.
1516 %
1517 % \end{description}
1518 %
1519 % \subsubsection{Tagging sockets}
1520 %
1521 % The following sockets are used to implement tagging. They are used
1522 % via \cs{UseTaggingSocket} which turns them off when tagging is
1523 % disabled.
1524 % For each of them a \plug{default} plug is implemented that holds the tagging code.
1525 %
1526 % \begin{description}
1527 %
1528 % \item[\socket{build/column/outputbox} (0 arguments)]
1529 % This socket is used to add any missing tagging structures to the
1530 % \cs{@outputbox} box, if necessary.
1531 %
1532 % \item[\socket{build/column/footins} (0 arguments)]
1533 % This socket is used to add any missing tagging structures to
1534 % \cs{footins} box, if necessary.
1535 %
1536 % \item[\socket{build/page/header} (2 arguments)]
1537 %
1538 % This socket receives the content of the formatted page header
1539 % as its second argument and adds the necessary tagging around
1540 % it. The first argument is empty as no special setup is
1541 % necessary.
1542 %
1543 % \item[\socket{build/page/footer} (2 arguments)]
1544 %
1545 % This socket receives the content of the formatted page footer
1546 % as its second argument and adds the necessary tagging around
1547 % it. The first argument is empty as no special setup is
1548 % necessary.
1549 %
1550 % \end{description}
1551 %
1552 %
1553 %
1554 %
1555 %
1556 % \subsubsection{Output routine commands}
1557 %
1558 %
1559 %
1560 %
1561 % \begin{macro}{\output}
1562 % \changes{v1.0f}{1993/12/05}{Command changed}
1563 % \begin{macro}{\@specialoutput}
1564 % \changes{v0.1c}{1993/11/23}{Command changed}
1565 % \changes{v1.0f}{1993/12/06}{Unboxing of 255 added to rescue writes}
1566 % This needs some small adjustments. We cannot
1567 % guarantee that the float mechanism will interact correctly with
1568 % this stuff, but that mechanism does not always work properly
1569 % with footnotes already.
1570 %
1571 % RmS 91/09/29:
1572 %
1573 % added reset of |\par| to the output routine.
1574 % This avoids problems when the output routine is
1575 % called within a list where |\par| may be a no-op.
1576 %
1577 % \begin{macrocode}
1578 \output {%
1579 \let \par \@@par
1580 \ifnum \outputpenalty<-\@M
1581 \@specialoutput
1582 \else
1583 \@makecol
1584 \@opcol
1585 % \end{macrocode}
1586 % Moved to |\@opcol|: |\@floatplacement|.
1587 % \begin{macrocode}
1588 \@startcolumn
1589 % \end{macrocode}
1590 % This loop could be replaced by an |\expandafter| tail
1591 % recursion in |\@startcolumn|.
1592 % \begin{macrocode}
1593 \@whilesw \if@fcolmade \fi
1594 {%
1595 %<*trace>
1596 \fl@trace{PAGE: float \if@twocolumn column \else page \fi
1597 completed}%
1598 %</trace>
1599 \@opcol\@startcolumn}%
1600 \fi
1601 \ifnum \outputpenalty>-\@Miv
1602 % \end{macrocode}
1603 % At points such as this we need to check that there is still a
1604 % minimal amount of room left on the page; this uses an arbitrary
1605 % small value at present. If there is little room left we just
1606 % force a page-break, OK?
1607 %
1608 % This bit is essential only if a float has just been processed so
1609 % maybe it should be moved; but this is the natural place at which
1610 % to set the vsize and a test would need to be done anyway. A
1611 % check has been added to ensure that there really has been a
1612 % change in the value of |\@colroom|.
1613 %
1614 % Since this happens only when there is nothing on the page but
1615 % floats, the empty box should not cause any problem other than
1616 % some overfull box messages, which is not entirely misleading.
1617 %
1618 % The twocolumn case does not need any extra code here since this
1619 % is the |\output| itself; in the second column there will still
1620 % not be enough room left so |\@emptycol| will be executed again
1621 % when the OR is called by the-page builder when it gets to the
1622 % penalty inserted by the first execution. (The page-builder is
1623 % never invoked whilst the OR is being executed since it builds a
1624 % inner vlist; thus any conditional code for the two-column case
1625 % within |\output| may not get executed with the correct value of
1626 % |\if@firstcolumn|.
1627 %
1628 % \task{???}{Make it less arbitrary?}
1629 % \changes{v1.0j}{1993/12/17}{Page room test added}
1630 % \changes{v1.0m}{1994/04/24}{Message changed to give more info and
1631 % `top' removed}
1632 % \changes{v1.0n}{1994/04/30}{Extra empty column added for
1633 % twocolumn case (wrong, see below)}
1634 % \changes{v1.0n}{1994/04/30}{Extra empty column added for
1635 % twocolumn case}
1636 % \changes{v1.0n}{1994/04/30}{Empty column action added:
1637 % \cs{@emptycol}}
1638 % \changes{v1.0n}{1994/04/30}{Cut-off point changed to
1639 % 2\cs{baselineskip}}
1640 % \changes{v1.1t}{1996/05/24}{Cut-off point changed to
1641 % 1.5\cs{baselineskip}}
1642 % \changes{v1.1t}{1996/05/24}{Check that \cs{@colroom} is less
1643 % than \cs{vsize}, indicating that a float has been added}
1644 % \changes{v1.1u}{1996/05/25}{Correct the above check}
1645 % \changes{v1.2c}{1997/11/09}{Remove incorrect code: only one
1646 % \cs{@emptycol} is needed here}
1647 % \begin{macrocode}
1648 \ifdim \@colroom<1.5\baselineskip
1649 \ifdim \@colroom<\textheight
1650 \@latex@warning@no@line {Text page \thepage\space
1651 contains only floats}%
1652 \@emptycol
1653 % \if@twocolumn
1654 % \if@firstcolumn
1655 % \else
1656 % \@emptycol
1657 % \fi
1658 % \fi
1659 \else
1660 \global \vsize \@colroom
1661 \fi
1662 \else
1663 \global \vsize \@colroom
1664 \fi
1665 \else
1666 \global \vsize \maxdimen
1667 \fi
1668 }
1669 % \end{macrocode}
1670 %
1671 % \begin{oldcomments}
1672 % CHANGES TO \@specialoutput:
1673 % * \penalty\z@ changed to \penalty\interlinepenalty so \samepage
1674 % works properly with figure and table environments.
1675 % (Changed 23 Oct 86)
1676 %
1677 % * Definition of \@specialoutput changed 26 Feb 88 so \@pageht and
1678 % \@pagedp aren't changed for a marginal note.
1679 % (Change suggested by Chris Rowley.)
1680 % \end{oldcomments}
1681 %
1682 % \begin{macrocode}
1683 \gdef\@specialoutput{%
1684 \ifnum \outputpenalty>-\@Mii
1685 \@doclearpage
1686 \else
1687 \ifnum \outputpenalty<-\@Miii
1688 \ifnum \outputpenalty<-\@MM \deadcycles \z@ \fi
1689 \global \setbox\@holdpg \vbox {\unvbox\@cclv}%
1690 \else
1691 % \end{macrocode}
1692 % Note that |\boxmaxdepth| should not be set here since we wish to
1693 % record the natural depth of the holdpg box.
1694 %
1695 % This is changed so as to not lose anything, such as writes
1696 % and marks, which may get into box 255 and should be returned to
1697 % the list. This should only happen when the first penalty in the
1698 % mechanism is discarded and therefore |\@holdpg| should always be
1699 % void in this case. This can happen because a penalty is
1700 % discarded whenever there is no box on the list.
1701 %
1702 % It was just: |\setbox\@tempboxa \box \@cclv|.
1703 %
1704 % The last box which is removed is the box put there by the
1705 % double-penalty mechanism. The |\unskip| then removes the
1706 % |\topskip| which is put there since the box is the first on the
1707 % page.
1708 % \task{CAR/FMi}{Is it more efficient to check whether the holdpg box
1709 % is void and then act accordingly?}
1710 % \begin{macrocode}
1711 \global \setbox\@holdpg \vbox{%
1712 \unvbox\@holdpg
1713 \unvbox\@cclv
1714 % \end{macrocode}
1715 % We must now remove the box added by the float mechanism and the
1716 % |\topskip| glue therefore added above it by \TeX.
1717 % \begin{macrocode}
1718 \setbox\@tempboxa \lastbox
1719 \unskip
1720 }%
1721 % \end{macrocode}
1722 % These two are needed as separate dimensions only by
1723 % |\@addmarginpar|; for other purposes we put the whole size into
1724 % |\@pageht| (see below).
1725 % \begin{macrocode}
1726 \@pagedp \dp\@holdpg
1727 \@pageht \ht\@holdpg
1728 \unvbox \@holdpg
1729 \@next\@currbox\@currlist{%
1730 \ifnum \count\@currbox>\z@
1731 % \end{macrocode}
1732 % Putting the whole size into |\@pageht| (see above).
1733 % \begin{macrocode}
1734 \advance \@pageht \@pagedp
1735 \ifvoid\footins \else
1736 \advance \@pageht \ht\footins
1737 \advance \@pageht \skip\footins
1738 \advance \@pageht \dp\footins
1739 \fi
1740 \ifvbox \@kludgeins
1741 % \end{macrocode}
1742 % We want to make the adjustment due to this insert only if the
1743 % non-star form is used. The *-form will probably not work with
1744 % floats, but maybe it still could make some adjustment here even
1745 % so?
1746 % \begin{macrocode}
1747 \ifdim \wd\@kludgeins=\z@
1748 \advance \@pageht \ht\@kludgeins
1749 %<*trace>
1750 \fl@trace {Extra size added: \the \ht\@kludgeins}%
1751 %</trace>
1752 \fi
1753 \fi
1754 % \end{macrocode}
1755 % This version puts the inserts back just before the additional
1756 % material; it could be moved earlier, before unboxing the
1757 % page-so-far. Neither is guaranteed not to put things on the wrong
1758 % page. This version is similar to the original version.
1759 % \begin{macrocode}
1760 \@reinserts
1761 \@addtocurcol
1762 \else
1763 \@reinserts
1764 \@addmarginpar
1765 \fi
1766 }\@latexbug
1767 % \end{macrocode}
1768 % A 2e change: use |\addpenalty| instead of |\penalty| here. Some
1769 % penalty is needed to create a potential break-point immediately
1770 % after the reinserts (or the marginal). Otherwise there can be no
1771 % possibility to break here and this can cause the reinserts or the
1772 % marginal to appear on the next page (which is often incorrect).
1773 % However, if the nobreak flag is true, a |\nobreak| must be
1774 % correct.
1775 % \changes{v1.1i}{1994/11/21}{Added \cs{if@nobreak} test}
1776 % \changes{v1.1z}{1996/10/24}{Added \cs{nobreak} as appropriate}
1777 % \begin{macrocode}
1778 \ifnum \outputpenalty<\z@
1779 \if@nobreak
1780 \nobreak
1781 \else
1782 \addpenalty \interlinepenalty
1783 \fi
1784 \fi
1785 \fi
1786 \fi
1787 }
1788 %</2ekernel|fltrace>
1789 % \end{macrocode}
1790 % \end{macro}
1791 % \end{macro}
1792 %
1793 % \begin{macro}{\@testwrongwidth}
1794 % \begin{macro}{\f@depth}
1795 % \changes{v1.2n}{2015/02/21}{macro added(latexrelease)}
1796 %
1797 % Test if the float box has the wrong width when trying to place it
1798 % into some area. (Actually
1799 % the test is for a conventional depth setting rather than for the
1800 % width of the float. For that reason the box depth was explicitly
1801 % tailored when the float was created).
1802 % \begin{macrocode}
1803 %<latexrelease>\IncludeInRelease{2015/01/01}%
1804 %<latexrelease> {\@testwrongwidth}{float order in 2-column}%
1805 %<*2ekernel|latexrelease|fltrace>
1806 % \end{macrocode}
1807 %
1808 % \begin{macrocode}
1809 \def\@testwrongwidth #1{%
1810 \ifdim\dp#1=\f@depth
1811 %<*trace>
1812 \fl@trace{\string#1
1813 \ifdim\f@depth=\z@ single \else double \fi
1814 column float -- ok}%
1815 %</trace>
1816 \else
1817 \global\@testtrue
1818 %<*trace>
1819 \fl@trace{\string#1
1820 \ifdim\f@depth=\z@ double \else single \fi
1821 column float -- wrong}%
1822 %</trace>
1823 \fi}%
1824 % \end{macrocode}
1825 %
1826 % Normally looking for single column floats, which have zero depth.
1827 % \begin{macrocode}
1828 \let\f@depth\z@
1829 % \end{macrocode}
1830 %
1831 % \begin{macrocode}
1832 %</2ekernel|latexrelease|fltrace>
1833 %<latexrelease>\EndIncludeInRelease
1834 %<latexrelease>\IncludeInRelease{0000/00/00}%
1835 %<latexrelease> {\@testwrongwidth}{float order in 2-column}%
1836 %<latexrelease>\let\@testwrongwidth\@undefined
1837 %<latexrelease>\let\f@depth\@undefined
1838 %<latexrelease>\EndIncludeInRelease
1839 % \end{macrocode}
1840 % \end{macro}
1841 % \end{macro}
1842 %
1843 %
1844 % \begin{macro}{\@doclearpage}
1845 % \task{CAR/FMi}{Investigate better float clearance}
1846 % \task{CAR/FMi}{Put non-boxes back in the `right place', or nowhere?}
1847 % This is a very much an emergency action, just dumping everything:
1848 % footnotes first then floats. A more sophisticated version is
1849 % needed; but even more urgent is a bug-free version (see, for
1850 % example, pr/3528).
1851 %
1852 % Also, it puts any left-over non-boxes (writes, specials, etc.) back
1853 % after any float pages created: this is a very bad bug since,
1854 % for example, a kludge insert will be in quite the wrong place
1855 % and, worse, be irremovable and uncancelable.
1856 %
1857 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
1858 % All the remaining changes are replacing the double column defer list
1859 % or inserting the extra test |\@testwrongwidth|\marg{box} at suitable
1860 % places. That is at places where a box is taken off the deferlist.
1861 % \begin{macrocode}
1862 %<latexrelease>\IncludeInRelease{2015/01/01}{\@doclearpage}%
1863 %<latexrelease> {float order in 2-column}%
1864 %<*2ekernel|latexrelease>
1865 \def \@doclearpage {%
1866 \ifvoid\footins
1867 % \end{macrocode}
1868 % \changes{v1.2n}{2015/01/14}{Empty kludgeins box if necessary, pr/3528}
1869 % \begin{macrocode}
1870 \ifvbox\@kludgeins
1871 {\setbox \@tempboxa \box \@kludgeins}%
1872 %<*trace>
1873 \fl@trace {kludgeins box made void}%
1874 %</trace>
1875 \fi
1876 \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
1877 \setbox\@tempboxa\box\@cclv
1878 \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
1879 \global \let \@toplist \@empty
1880 \global \let \@botlist \@empty
1881 \global \@colroom \@colht
1882 \ifx \@currlist\@empty
1883 \else
1884 \@latex@error{Float(s) lost}\@ehb
1885 \global \let \@currlist \@empty
1886 \fi
1887 \@makefcolumn\@deferlist
1888 \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
1889 \if@twocolumn
1890 \if@firstcolumn
1891 % \end{macrocode}
1892 %
1893 % \begin{macrocode}
1894 \xdef\@deferlist{\@dbltoplist\@deferlist}%
1895 % \end{macrocode}
1896 %
1897 % \begin{macrocode}
1898 \global \let \@dbltoplist \@empty
1899 \global \@colht \textheight
1900 \begingroup
1901 \@dblfloatplacement
1902 % \end{macrocode}
1903 %
1904 % \begin{macrocode}
1905 \@makefcolumn\@deferlist
1906 \@whilesw\if@fcolmade \fi{\@outputpage
1907 \@makefcolumn\@deferlist}%
1908 % \end{macrocode}
1909 %
1910 % \begin{macrocode}
1911 \endgroup
1912 \else
1913 \vbox{}\clearpage
1914 \fi
1915 \fi
1916 % \end{macrocode}
1917 % the next line is needed to avoid losing floats in certain
1918 % circumstances a single call to the original |\doclearpage|
1919 % will now no longer output all floats.
1920 % \changes{v1.2b}{2000/09/24}{FMi: ensure \cs{doclearpage}
1921 % is called again until all floats are output.}
1922 % \begin{macrocode}
1923 \ifx\@deferlist\@empty \else\clearpage \fi
1924 \else
1925 \setbox\@cclv\vbox{\box\@cclv\vfil}%
1926 \@makecol\@opcol
1927 \clearpage
1928 \fi
1929 }%
1930 %</2ekernel|latexrelease>
1931 %<latexrelease>\EndIncludeInRelease
1932 %<latexrelease>\IncludeInRelease{0000/00/00}{\@doclearpage}%
1933 %<latexrelease> {float order in 2-column}%
1934 %<latexrelease>\def \@doclearpage {%
1935 %<latexrelease> \ifvoid\footins
1936 % \end{macrocode}
1937 % \changes{v1.2l}{2004/02/07}{Empty kludgeins box if necessary, pr/3528}
1938 % We empty any left over kludge insert box here; this is a temporary fix.
1939 % It should perhaps be applied to one page of cleared floats, but
1940 % who cares? The whole of this stuff needs completely redoing for
1941 % many such reasons.
1942 % \begin{macrocode}
1943 %<latexrelease> \ifvbox\@kludgeins
1944 %<latexrelease> {\setbox \@tempboxa \box \@kludgeins}%
1945 %<*trace>
1946 %<latexrelease> \fl@trace {kludgeins box made void}%
1947 %</trace>
1948 %<latexrelease> \fi
1949 %<latexrelease> \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
1950 %<latexrelease> \setbox\@tempboxa\box\@cclv
1951 %<latexrelease> \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
1952 % \end{macrocode}
1953 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
1954 % \begin{macrocode}
1955 %<latexrelease> \global \let \@toplist \@empty
1956 %<latexrelease> \global \let \@botlist \@empty
1957 %<latexrelease> \global \@colroom \@colht
1958 %<latexrelease> \ifx \@currlist\@empty
1959 %<latexrelease> \else
1960 %<latexrelease> \@latexerr{Float(s) lost}\@ehb
1961 % \end{macrocode}
1962 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
1963 % \begin{macrocode}
1964 %<latexrelease> \global \let \@currlist \@empty
1965 %<latexrelease> \fi
1966 %<latexrelease> \@makefcolumn\@deferlist
1967 %<latexrelease> \@whilesw\if@fcolmade \fi
1968 %<latexrelease> {\@opcol\@makefcolumn\@deferlist}%
1969 %<latexrelease> \if@twocolumn
1970 %<latexrelease> \if@firstcolumn
1971 %<latexrelease> \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}%
1972 % \end{macrocode}
1973 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
1974 % \begin{macrocode}
1975 %<latexrelease> \global \let \@dbltoplist \@empty
1976 %<latexrelease> \global \@colht \textheight
1977 %<latexrelease> \begingroup
1978 %<latexrelease> \@dblfloatplacement
1979 %<latexrelease> \@makefcolumn\@dbldeferlist
1980 %<latexrelease> \@whilesw\if@fcolmade \fi
1981 %<latexrelease> {\@outputpage\@makefcolumn\@dbldeferlist}%
1982 %<latexrelease> \endgroup
1983 %<latexrelease> \else
1984 %<latexrelease> \vbox{}\clearpage
1985 %<latexrelease> \fi
1986 %<latexrelease> \fi
1987 %<latexrelease> \else
1988 %<latexrelease> \setbox\@cclv\vbox{\box\@cclv\vfil}%
1989 %<latexrelease> \@makecol\@opcol
1990 %<latexrelease> \clearpage
1991 %<latexrelease> \fi
1992 %<latexrelease> }%
1993 %<latexrelease>\EndIncludeInRelease
1994 % \end{macrocode}
1995 % \end{macro}
1996 %
1997 % \begin{macro}{\@opcol}
1998 % \changes{v1.0f}{1993/12/05}{Command changed}
1999 % \changes{v1.0f}{1993/12/05}{Hook added}
2000 % \changes{v1.0j}{1993/12/17}{Hook removed}
2001 % Several changes in detail here.
2002 %
2003 % \begin{macrocode}
2004 %<*2ekernel|fltrace>
2005 \def \@opcol {%
2006 \if@twocolumn
2007 % \end{macrocode}
2008 % \changes{v1.ih}{2022/04/03}{Interface with new mark mechanism}
2009 % The funny-looking internal commands are interfacing with the new
2010 % marks mechanism. We make sure (elsewhere) that those are always
2011 % defined, even when we roll back, so here we add them
2012 % unconditionally. This still need turning into a hook or config
2013 % point eventually:
2014 % \begin{macrocode}
2015 \@expl@@@mark@update@dblcol@structures@@
2016 \@outputdblcol
2017 \else
2018 \@expl@@@mark@update@singlecol@structures@@
2019 \@outputpage
2020 %<*trace>
2021 \fl@trace{PAGE: one column (float? see above) page completed}%
2022 %</trace>
2023 % \end{macrocode}
2024 % Not needed since it comes after |\@outputpage|:
2025 % \begin{macrocode}
2026 % \global\@colht\textheight
2027 \fi
2028 % \end{macrocode}
2029 % These do not need to be done every time |\@opcol| is used: they
2030 % should be grouped together since they all need to be done at the
2031 % end of the non-special output routine, or at the end of a clearpage
2032 % one.
2033 % \begin{macrocode}
2034 \global \@mparbottom \z@ \global \@textfloatsheight \z@
2035 \@floatplacement
2036 }
2037 %</2ekernel|fltrace>
2038 % \end{macrocode}
2039 % \end{macro}
2040 %
2041 %
2042 % \begin{macrocode}
2043 %<*2ekernel|latexrelease>
2044 %<latexrelease>\IncludeInRelease{2025/06/01}%
2045 %<latexrelease> {\@makecol}{\@makecol adding hooks/sockets}%
2046 % \end{macrocode}
2047 %
2048 % \begin{macro}{\@makecol}
2049 % \changes{v0.1c}{1993/11/23}{Command changed}
2050 % \changes{v1.0b}{1993/11/29}{\cs{@makespecialcolbox} added}
2051 % \changes{v1.4m}{2025/02/14}{Use sockets and hooks}
2052 %
2053 % \cs{@makecol} is shortened a lot, basically all the hardwired
2054 % code in the middle has moved into a socket.
2055 % \begin{macrocode}
2056 \def \@makecol {%
2057 % \end{macrocode}
2058 % A number of packages want to prepend code to \cs{@makecol}; this
2059 % is the hook for that:
2060 % \begin{macrocode}
2061 \UseHook {build/column/before}%
2062 % \end{macrocode}
2063 % Save away box 255 as \cs{@outputbox} to make it available for further adjustments.
2064 % \begin{macrocode}
2065 \setbox\@outputbox \box\@cclv
2066 % \end{macrocode}
2067 % The only real addition is the next command which either does
2068 % nothing or removes an infinite glue from the bottom of the
2069 % \cs{@outputbox}.
2070 % \begin{macrocode}
2071 \@outputbox@removebskip
2072 % \end{macrocode}
2073 % Now a kernel hook for tagging that adjusts the content of
2074 % \cs{@outputbox}, if necessary. At this point it just contains the material from
2075 % the galley.
2076 % \begin{macrocode}
2077 \UseTaggingSocket{build/column/outputbox}%
2078 % \end{macrocode}
2079 % When this code is run any ``here'' floats in the \cs{@outputbox}
2080 % are already handled, so we recycle their registers and put them
2081 % back to the \cs{@freelist}.
2082 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
2083 % \changes{v1.2k}{2003/12/16}{Ensure that \cs{@elt} has a defined
2084 % state (pr/3586)}
2085 % \begin{macrocode}
2086 \let\@elt\relax
2087 \xdef\@freelist{\@freelist\@midlist}%
2088 \global \let \@midlist \@empty
2089 % \end{macrocode}
2090 % Here we have the configurable part. This socket is supposed to
2091 % add floats, footnotes and stretchable vertical space as
2092 % appropriate to the \cs{@outputbox}. It is used by packages such
2093 % as \pkg{footmisc} to implement different layout, e.g., footnotes
2094 % above or below bottom floats, etc.
2095 % \begin{macrocode}
2096 \UseSocket {build/column/outputbox}%
2097 % \end{macrocode}
2098 % Then we deal with any \cs{enlargethispage} or run the normal code
2099 % to build a column.
2100 % \begin{macrocode}
2101 \ifvbox\@kludgeins
2102 \@make@specialcolbox
2103 \else
2104 \@make@normalcolbox
2105 \fi
2106 \global \maxdepth \@maxdepth
2107 % \end{macrocode}
2108 % Finally, another hook for external packages or classes that want
2109 % to augment or alter the output routine by appending to \cs{@makecol}.
2110 % \begin{macrocode}
2111 \UseHook {build/column/after}%
2112 }
2113 % \end{macrocode}
2114 % \end{macro}
2115 %
2116 % \begin{macro}{\@outputbox@depth}
2117 % \changes{v1.4m}{2025/02/14}{Macro added}
2118 % We need to know the depth of \cs{@outputbox} once in a
2119 % while. Rather than using a temp dimen (as it was done in the
2120 % past), we give it a proper register.
2121 %
2122 % The value of this register is only correct inside of
2123 % \cs{outputbox@append}, elsewhere you can't rely on it!
2124 % \begin{macrocode}
2125 \newdimen\@outputbox@depth
2126 % \end{macrocode}
2127 % \end{macro}
2128 %
2129 %
2130 % \begin{macro}{\@make@normalcolbox}
2131 % \changes{v1.4m}{2025/02/14}{Macro added}
2132 % Taken out of \cs{@makecol} for readability.
2133 %
2134 % \changes{v1.0l}{1994/03/15}{Removed boxmaxdepth setting.}
2135 % \begin{macrocode}
2136 \def \@make@normalcolbox {%
2137 \setbox\@outputbox \vbox to\@colht {%
2138 \@texttop
2139 \@outputbox@depth \dp\@outputbox
2140 \unvbox \@outputbox
2141 % \end{macrocode}
2142 % The |\vskip -\@outputbox@depth@| ensures that the visible depth
2143 % of the box does not affect the placement of anything on the page.
2144 % Thus very deep pages will overprint the footer; but these should
2145 % have been prevented by suitable settings of the maxdepths at
2146 % appropriate times.
2147 %
2148 % If |\@textbottom| ends with a box or rule of non-zero depth then
2149 % this skip adjustment should be done again after it.
2150 % \begin{macrocode}
2151 \vskip -\@outputbox@depth
2152 \@textbottom
2153 }%
2154 }
2155 % \end{macrocode}
2156 % \end{macro}
2157 %
2158 % \begin{macro}{\@make@specialcolbox}
2159 % \changes{v1.4m}{2025/02/14}{Macro added}
2160 % Make the colbox when \cs{enlargethispage} was used.
2161 % \begin{macrocode}
2162 %</2ekernel|latexrelease>
2163 %<*2ekernel|latexrelease|fltrace>
2164 \def \@make@specialcolbox {%
2165 %<*trace>
2166 \fl@trace{Kludgeins ht \the\ht\@kludgeins\space
2167 dp \the\dp\@kludgeins\space
2168 wd \the\wd\@kludgeins}%
2169 %</trace>
2170 \@outputbox@append {\vskip-\@outputbox@depth}%
2171 \@tempdima \@colht
2172 % \end{macrocode}
2173 %
2174 % \begin{macrocode}
2175 \ifdim \wd\@kludgeins>\z@
2176 % \end{macrocode}
2177 % Note that in this case (the *-version), the height of the
2178 % |\@kludgeins| box is not used since its value is somewhat
2179 % arbitrary: it need only be big enough to ensure that the
2180 % page-break is not taken prematurely.
2181 %
2182 % Here we calculate how much vertical space needs to be added in
2183 % order to enable the column to fit into a box of size |\@colht|
2184 % using the best information we have about the amount of shrink
2185 % available (another thing which is known internally about a box,
2186 % but cannot be accessed at the \TeX{} level!).
2187 %
2188 % This needs \TeX3 otherwise |\pageshrink| is zero anyway; it may
2189 % not be exactly the figure we wish as it is the total available
2190 % from the all the material collected before the page-break
2191 % decision is made. It will, we think, always be an overestimate
2192 % of the actual shrink in the box; therefore this should always
2193 % force the shortest possible column with the possibility of an
2194 % overfull box.
2195 %
2196 % This should work for both flush- and ragged-bottom setting since
2197 % it makes the contents no smaller than the size (|\@colht|) of the
2198 % box into which they are put.
2199 %
2200 % Their should perhaps be an upper limit, of 0pt?, on the extra
2201 % space added to force shrinking.
2202 % \task{CAR}{Further investigation of kludge-* space}
2203 %
2204 % \begin{macrocode}
2205 \advance \@tempdima -\ht\@outputbox
2206 \advance \@tempdima \pageshrink
2207 %<*trace>
2208 \fl@trace {Natural ht of col: \the \ht\@outputbox}%
2209 \fl@trace {\string \@colht: \the \@colht}%
2210 \fl@trace {Pageshrink added: \the \pageshrink}%
2211 \fl@trace {Hence, space added: \the \@tempdima}%
2212 %</trace>
2213 \setbox\@outputbox \vbox to \@colht {%
2214 \unvbox\@outputbox
2215 \vskip \@tempdima
2216 \@textbottom
2217 }%
2218 % \end{macrocode}
2219 % For the unstarred version, the final size of the page is
2220 % precisely specified. Therefore, at least for the flush-bottom
2221 % case, we need to ensure that, visually, it has this size exactly.
2222 %
2223 % Thus we calculate this size and set the material in a box of this
2224 % size, which is then put into a box of size |\@colht| with |\vss|
2225 % at the bottom.
2226 % \begin{macrocode}
2227 \else
2228 \advance \@tempdima -\ht\@kludgeins
2229 %<*trace>
2230 \fl@trace {Natural ht of col: \the \ht\@outputbox}%
2231 \fl@trace {\string \@colht: \the \@colht}%
2232 \fl@trace {Extra size added: -\the \ht \@kludgeins}%
2233 \fl@trace {Hence, height of inner box: \the \@tempdima}%
2234 \fl@trace {Max? pageshrink available: \the \pageshrink}%
2235 %</trace>
2236 % \end{macrocode}
2237 % This type of final packaging could be done always; this may
2238 % simplify all of this page-makeup.
2239 %
2240 % It is not necessary to set |\boxmaxdepth| here since the
2241 % |\@outputbox| ends with glue.
2242 % \changes{v1.0k}{1994/02/03}{correct mistakes in the documentation}
2243 % \begin{macrocode}
2244 \setbox \@outputbox \vbox to \@colht {%
2245 \vbox to \@tempdima {%
2246 \unvbox\@outputbox
2247 \@textbottom}%
2248 \vss}%
2249 \fi
2250 {\setbox \@tempboxa \box \@kludgeins}%
2251 %<*trace>
2252 \fl@trace {kludgeins box made void}%
2253 %</trace>
2254 }
2255 %</2ekernel|latexrelease|fltrace>
2256 %<*2ekernel|latexrelease>
2257 % \end{macrocode}
2258 % \end{macro}
2259 %
2260 %
2261 %
2262 %
2263 % \begin{macro}{\@outputbox@removebskip}
2264 % \changes{v1.4m}{2025/02/14}{Macro added}
2265 % \changes{v1.4m}{2025/02/14}{Finally fix bottom skip bug (from 2.09)}
2266 %
2267 % This is really a bug fix for the kernel (from the 2.09 days) but
2268 % one we only make by default in new documents that are using
2269 % \cs{DocumentMetadata}. If \cs{raggedbottom} is in force,
2270 % footnotes get attached to the main galley at a distance of
2271 % \cs{footskip} on all pages except on those that are ended by
2272 % \cs{newpage} or \cs{clearpage} where the \cs{vfil} from
2273 % \cs{newpage} pushes the footnotes to the very bottom.
2274 %
2275 % This is kind of a weird difference to a page ending with
2276 % \cs{pagebreak}---in that case the page is also run
2277 % short, but the footnotes are not pushed to the bottom.
2278 %
2279 % In \pkg{footmisc} \cs{@outputbox@removebskip} is only applied when
2280 % \pkg{footmisc} is called with an option specifying the
2281 % footnote placement, i.e., not in the default case.
2282 % In new documents we apply it always.
2283 % \changes{v1.4q}{2025/03/20}{Remove a `fil' bottom skip even if we
2284 % are in ragged bottom typesetting (footmisc/19)}
2285 % \begin{macrocode}
2286 \def\@outputbox@removebskip{%
2287 % \end{macrocode}
2288 % In some special circumstances the \cs{@outputbox} might be
2289 % void. As \cs{@outputbox@append} below would change this, we
2290 % handle this case by leaving it unchanged,
2291 % because otherwise we can no longer detect that situation
2292 % (needed, for example, in \pkg{ftnright}).
2293 % \begin{macrocode}
2294 \ifvoid \@outputbox
2295 \global\let\@outputbox@reinsertbskip\relax
2296 \else
2297 % \end{macrocode}
2298 % If it is not void then we drop the final skip at the end of \cs{@outputbox}
2299 % provided there is one and it has a glue stretch
2300 % order of 1 or more (i.e., contains a \texttt{fil} or \texttt{fill} part).
2301 % \begin{macrocode}
2302 \@outputbox@append{%
2303 \@tempskipa\lastskip
2304 \ifnum \gluestretchorder\@tempskipa>\z@
2305 \unskip
2306 % \end{macrocode}
2307 %
2308 % \begin{macro}{\@outputbox@reinsertbskip}
2309 % We also prepare for reinserting the skip we removed elsewhere on the page.
2310 % As we have to do this globally, we also need to
2311 % explicitly reset \cs{@outputbox@reinsertbskip} if we don't find any such glue.
2312 % \begin{macrocode}
2313 \xdef\@outputbox@reinsertbskip
2314 {%
2315 % \end{macrocode}
2316 % Everything is done inside \cs{@outputbox@append} so that a call
2317 % to \cs{@outputbox@reinsertbskip} will update the box. If there
2318 % are no footnotes and no bottom floats that still needs to be
2319 % attached we first backup by the depth of the
2320 % \cs{@outputbox} so that the skip we add starts from the baseline
2321 % of the last line inside (if there is one). As it is a
2322 % \texttt{fil}, \texttt{fill}, or \texttt{filll} glue this normally
2323 % makes no differences, but if the box itself contains a fill skip
2324 % of higher order our fill is ignored and text is pushed to the
2325 % bottom of the page. In that case and without backing up first,
2326 % the last line would not be with its baseline on the bottom, but
2327 % slightly too high if it has characters with descenders.
2328 % \changes{v1.4r}{2025/03/25}{Back out the depth if we have no
2329 % footnotes and no bottom floats (footmisc/19)}
2330 % \begin{macrocode}
2331 \noexpand\@outputbox@append{%
2332 \noexpand\@if@footnotes@TF
2333 {}%
2334 {%
2335 \noexpand\@if@bottomfloats@TF
2336 {}%
2337 {\noexpand\@backup@outputbox@depth}%
2338 }%
2339 \vskip\the\@tempskipa}}%
2340 \else
2341 \global\let\@outputbox@reinsertbskip\relax
2342 \fi
2343 }%
2344 \fi
2345 }
2346 % \end{macrocode}
2347 % We need a trivial top-level definition for
2348 % \cs{@outputbox@reinsertbskip} in case the first page has no
2349 % bottom glue and the command gets called.
2350 % \begin{macrocode}
2351 \let \@outputbox@reinsertbskip \relax
2352 % \end{macrocode}
2353 % \end{macro}
2354 % \end{macro}
2355 %
2356 %
2357 %
2358 % \begin{macro}{\@backup@outputbox@depth}
2359 % In some places we have to make the depth of the \cs{@outputbox}
2360 % zero by backing up by its current depth. This is done by
2361 % \cs{@backup@outputbox@depth}. The macro can only be used inside
2362 % of \cs{@outputbox@append} (or after you have manually set the
2363 % \cs{@outputbox@depth} to the right value).
2364 %
2365 % If the depth is zero, there is no point in doing anything, and if
2366 % the depth is negative it must have been deliberately set to this
2367 % value, so in this case we also do not back up and change it.
2368 %
2369 % If it is positive we back up by the minimum of
2370 % \cs{@outputbox@depth} and \cs{maxdepth}, i.e., if the depth is
2371 % unusually large we do not perform a full backup.
2372 %
2373 % \changes{v1.4r}{2025/03/25}{Macro added (footmisc/19)}
2374 % \begin{macrocode}
2375 \def\@backup@outputbox@depth{%
2376 % \typeout{--> @backup@outputbox@depth : \the \@outputbox@depth}%
2377 \ifdim\@outputbox@depth>\z@
2378 \vskip -%
2379 \ifdim\@outputbox@depth>\maxdepth
2380 \maxdepth
2381 \else
2382 \@outputbox@depth
2383 \fi
2384 % \end{macrocode}
2385 % After the skip was added the depth of the box will become zero
2386 % but this is not immediately reflected in
2387 % \cs{@outputbox@depth}. Thus, if there is further code in the same
2388 % \cs{@outputbox@append} testing the register it would make a wrong
2389 % conclusion. We therefore set it locally to zero.
2390 % \begin{macrocode}
2391 \@outputbox@depth\z@
2392 \fi
2393 }
2394 % \end{macrocode}
2395 % \end{macro}
2396 %
2397 % \subsection{The output routine configuration components}
2398 %
2399 % Here we provide the comands that are used to define code for the
2400 % socket \socket{build/column/outputbox}. The all manipulate the
2401 % \cs{@outputbox} box in one way or another.
2402 %
2403 %
2404 % \begin{macro}{\@outputbox@append}
2405 % \changes{v1.4m}{2025/02/14}{Macro added}
2406 %
2407 % This general purpose command alters the \cs{@outputbox} box by
2408 % appending material to it. As this is a box typesetting operation
2409 % we make sure that the last line of the box reflects the true
2410 % depth of the last line (in case that is needed later). We also
2411 % expose the current depth of \cs{@outputbox} as
2412 % \cs{@outputbox@depth} before unboxing so that its value can be
2413 % used by \verb=#1= if wanted.
2414 % \begin{macrocode}
2415 \def\@outputbox@append #1{%
2416 \setbox\@outputbox \vbox {%
2417 % \end{macrocode}
2418 % This |\boxmaxdepth| setting is to ensure that deep footnotes
2419 % do not overwrite the footer (on account of the negative skip
2420 % added later): it should use |\@maxdepth| otherwise the change is
2421 % pointless when there are footnotes.
2422 %
2423 % But see also its use when combining floats.
2424 % \changes{v1.0l}{1994/03/15}{\cs{maxdepth} changed to \cs{@maxdepth}}
2425 % \begin{macrocode}
2426 \boxmaxdepth \@maxdepth
2427 \@outputbox@depth\dp\@outputbox % if needed in #1
2428 \unvbox \@outputbox
2429 #1%
2430 }%
2431 }
2432 % \end{macrocode}
2433 % \end{macro}
2434 %
2435 %
2436 %
2437 % \begin{macro}{\@outputbox@appendfil}
2438 % Append a \cs{vfil} to the \cs{@outputbox}. Depending on the plug
2439 % in the \socket{build/column/baselineattach} either from the
2440 % bottom of the box or the baseline of the last line.
2441 % \begin{macrocode}
2442 \def\@outputbox@appendfil{\@outputbox@append
2443 {\UseSocket{build/column/baselineattach}\vfil}}
2444 % \end{macrocode}
2445 % \end{macro}
2446 %
2447 %
2448 % \begin{macro}{\@outputbox@appendfootnotes}
2449 % \changes{v1.4m}{2025/02/14}{Macro added}
2450 %
2451 % This command appends the footnotes to the \cs{@outputbox} (if
2452 % there are any). If not, then it does nothing.
2453 % \begin{macrocode}
2454 \def\@outputbox@appendfootnotes {%
2455 \ifvoid\footins \else
2456 % \end{macrocode}
2457 % Handling split footnotes need further work so this is for the
2458 % moment just a dummy that does nothing. It might vanish and get
2459 % replaced by a socket eventually.
2460 % \task{fmi}{The code for handling split footnotes will get revised as part
2461 % of socket handling in the future}
2462 % \begin{macrocode}
2463 \@makecol@handlesplitfootnotes
2464 % \end{macrocode}
2465 %
2466 % The following socket can be used to manipulate the material in
2467 % \cs{footins} box, for example, if the footnotes are to be presented
2468 % all together in a single paragraph. By default it does nothing.
2469 % \begin{macrocode}
2470 \UseSocket{build/column/footnotes}%
2471 % \end{macrocode}
2472 % Then the footnotes are appended:
2473 % \begin{macrocode}
2474 \@outputbox@append{%
2475 % \end{macrocode}
2476 % First we call a socket which controls whether or not we back up by the depth
2477 % of the \cs{@outputbox} so that the skip that seperates the
2478 % footnotes from the text starts at the baseline
2479 % of the last text line.
2480 % \changes{v1.4q}{2025/03/20}{Add experimental socket for baseline
2481 % attachment of footnotes -- subject to change (footmisc/19)}
2482 % \begin{macrocode}
2483 \UseSocket{build/column/baselineattach}%
2484 \vskip \skip\footins
2485 % \end{macrocode}
2486 % The next socket adjusts the tagging of the \cs{footins} box, if necessary.
2487 % \begin{macrocode}
2488 \UseTaggingSocket{build/column/footins}%
2489 % \end{macrocode}
2490 %
2491 % \begin{macrocode}
2492 \color@begingroup
2493 \normalcolor
2494 \footnoterule
2495 % \end{macrocode}
2496 % Support for \pkg{pdfcolfoot}; eventually this can go once color
2497 % is properly supported. The csname is constructed in case the command
2498 % is not defined, i.e., the package not loaded.
2499 % \task{fmi}{Fix when no longer needed}
2500 % \begin{macrocode}
2501 \csname pdfcolfoot@current\endcsname
2502 \unvbox \footins
2503 \color@endgroup
2504 }%
2505 \fi
2506 }
2507 % \end{macrocode}
2508 % \end{macro}
2509 %
2510 %
2511 % \begin{macro}{\@makecol@handlesplitfootnotes}
2512 % For future extensions \ldots
2513 % \begin{macrocode}
2514 \let \@makecol@handlesplitfootnotes \@empty
2515 % \end{macrocode}
2516 % \end{macro}
2517 %
2518 % \begin{macro}{\@outputbox@attachfloats}
2519 % \changes{v1.4m}{2025/02/14}{Macro added}
2520 % \begin{macro}{\@outputbox@attachtopfloats}
2521 % \changes{v1.4m}{2025/02/14}{Macro added}
2522 % \begin{macro}{\@outputbox@attachbottomfloats}
2523 % \changes{v1.4m}{2025/02/14}{Macro added}
2524 % Attaching top and bottom floats can usually be done in one go,
2525 % but for special layouts we might want more control so we provide
2526 % also separate commands.
2527 %
2528 % The next command was called \cs{@combinefloats} in the past.
2529 % \begin{macrocode}
2530 \def \@outputbox@attachfloats {%
2531 \@outputbox@attachtopfloats
2532 \@outputbox@attachbottomfloats
2533 }
2534 % \end{macrocode}
2535 %
2536 % \begin{macrocode}
2537 \def \@outputbox@attachtopfloats {%
2538 \ifx \@toplist\@empty \else \@cflt \fi
2539 }
2540 % \end{macrocode}
2541 % Before we append the bottom floats we run the
2542 % \socket{build/column/baselineattach} so that the
2543 % \cs{textfloatsep} is measured from the baseline if that is desired.
2544 % \changes{v1.4s}{2025/03/29}{Add socket (footmisc/19)}
2545 % \begin{macrocode}
2546 \def \@outputbox@attachbottomfloats {%
2547 \ifx \@botlist\@empty \else
2548 \@outputbox@append{\UseSocket{build/column/baselineattach}}%
2549 \@cflb
2550 \fi
2551 }
2552 % \end{macrocode}
2553 % \end{macro}
2554 % \end{macro}
2555 % \end{macro}
2556 %
2557 %
2558 % The next three conditionals might be useful when setting up running
2559 % headers and footers so perhaps they should be change to CamelCase
2560 % names. For now they are internal.
2561 %
2562 % \begin{macro}{\@if@flushbottom@TF}
2563 % \changes{v1.4m}{2025/02/14}{Macro added}
2564 % Test for \cs{flushbottom} (currently not used).
2565 % \begin{macrocode}
2566 \def\@if@flushbottom@TF{%
2567 \ifx\@textbottom\relax
2568 \expandafter\@firstoftwo
2569 \else
2570 \expandafter\@secondoftwo
2571 \fi
2572 }
2573 % \end{macrocode}
2574 % \end{macro}
2575 %
2576 %
2577 % \begin{macro}{\@if@footnotes@TF}
2578 % \changes{v1.4m}{2025/02/14}{Macro added}
2579 % Test if footnotes are present on the current page or column and
2580 % not yet added to the \cs{@outputbox}.
2581 % \begin{macrocode}
2582 \def\@if@footnotes@TF{%
2583 \ifvoid\footins
2584 \expandafter\@secondoftwo
2585 \else
2586 \expandafter\@firstoftwo
2587 \fi
2588 }
2589 % \end{macrocode}
2590 % \end{macro}
2591 %
2592 %
2593 % \begin{macro}{\@if@bottomfloats@TF}
2594 % \changes{v1.4m}{2025/02/14}{Macro added}
2595 % Test if bottom floats are around and not yet added to the
2596 % \cs{@outputbox}.
2597 % \begin{macrocode}
2598 \def\@if@bottomfloats@TF{%
2599 \ifx \@botlist\@empty
2600 \expandafter\@secondoftwo
2601 \else
2602 \expandafter\@firstoftwo
2603 \fi
2604 }
2605 % \end{macrocode}
2606 % \end{macro}
2607 %
2608 %
2609 %
2610 %
2611 %
2612 %
2613 %
2614 % \changes{v1.4m}{2025/02/14}{Use sockets and hooks in OR}
2615 %
2616 % \begin{socketdecl}{build/column/outputbox}
2617 % \changes{v1.4m}{2025/02/14}{Socket added}
2618 % We have one socket that is supposed to augment the \cs{@outputbox}
2619 % by attaching floats and footnotes with appropriate spacing.
2620 % \begin{macrocode}
2621 \NewSocket{build/column/outputbox}{0}
2622 % \end{macrocode}
2623 % \end{socketdecl}
2624 %
2625 %
2626 % The following plugs are available for
2627 % this socket:
2628 %
2629 % \begin{plugdecl}{space-footnotes-floats}
2630 % After the galley text there is a vertical \cs{vfil} followed by
2631 % any footnotes followed by the bottom floats, if any.
2632 % \begin{macrocode}
2633 \NewSocketPlug {build/column/outputbox}{space-footnotes-floats} {%
2634 \@if@footnotes@TF
2635 {\@outputbox@appendfil}%
2636 {\@if@bottomfloats@TF
2637 {\@outputbox@appendfil}%
2638 {\@outputbox@reinsertbskip}%
2639 }%
2640 \@outputbox@appendfootnotes
2641 \@outputbox@attachfloats
2642 }
2643 % \end{macrocode}
2644 % \end{plugdecl}
2645 %
2646 % \begin{plugdecl}{footnotes-space-floats}
2647 % As before but the \cs{vfil} is between footnotes and floats.
2648 % \begin{macrocode}
2649 \NewSocketPlug {build/column/outputbox}{footnotes-space-floats} {%
2650 \@outputbox@appendfootnotes
2651 \@if@bottomfloats@TF
2652 {\@outputbox@appendfil}%
2653 {\@outputbox@reinsertbskip}%
2654 \@outputbox@attachfloats
2655 }
2656 % \end{macrocode}
2657 % \end{plugdecl}
2658 %
2659 % \begin{plugdecl}{floats-space-footnotes}
2660 % Floats immediately after the galley text and footnotes at the bottom.
2661 % \begin{macrocode}
2662 \NewSocketPlug {build/column/outputbox}{floats-space-footnotes} {%
2663 \@outputbox@attachfloats
2664 \@if@footnotes@TF
2665 {\@outputbox@appendfil}%
2666 {\@outputbox@reinsertbskip}%
2667 \@outputbox@appendfootnotes
2668 }
2669 % \end{macrocode}
2670 % \end{plugdecl}
2671 %
2672 % \begin{plugdecl}{space-floats-footnotes}
2673 % Both floats and footnotes are pushed to the bottom with
2674 % footnotes last.\footnote{There are two more
2675 % permutations, but neither of them has ever been requested so
2676 % they aren't set up by default --- doing that in a class
2677 % would be trivial though.}
2678 % \begin{macrocode}
2679 \NewSocketPlug {build/column/outputbox}{space-floats-footnotes} {%
2680 \@if@bottomfloats@TF
2681 {\@outputbox@appendfil}%
2682 {\@if@footnotes@TF
2683 {\@outputbox@appendfil}%
2684 {\@outputbox@reinsertbskip}}%
2685 \@outputbox@attachfloats
2686 \@outputbox@appendfootnotes
2687 }
2688 % \end{macrocode}
2689 % \end{plugdecl}
2690 %
2691 %
2692 %
2693 % \begin{plugdecl}{floats-footnotes}
2694 % All excess space has to be distributed across the existing
2695 % glue on the page, e.g., within the text galley, the
2696 % separation between blocks, etc.
2697 % The order is text, floats, footnotes.
2698 % \begin{macrocode}
2699 \NewSocketPlug {build/column/outputbox}{floats-footnotes} {%
2700 \@outputbox@attachfloats
2701 \@outputbox@appendfootnotes
2702 % \end{macrocode}
2703 % We do reinsert the bottom skip from \cs{newpage} if it
2704 % was taken out earlier. This is, strictly speaking, not necessary
2705 % in most cases, but it is a \cs{vfil} while \cs{raggedbottom} is
2706 % only generating \verb=\vspace{0pt plus .0001fil}=, so if you have
2707 % several \cs{vfil} on the page before the \cs{newpage} you would
2708 % alter the space distribution if one is taken out.
2709 % \begin{macrocode}
2710 \@outputbox@reinsertbskip
2711 }
2712 % \end{macrocode}
2713 %
2714 % \end{plugdecl}
2715 %
2716 % \begin{plugdecl}{footnotes-floats}
2717 % \begin{macrocode}
2718 \NewSocketPlug {build/column/outputbox}{footnotes-floats} {%
2719 \@outputbox@appendfootnotes
2720 \@outputbox@attachfloats
2721 \@outputbox@reinsertbskip
2722 }
2723 % \end{macrocode}
2724 % The \texttt{footnote-floats} plug implements the layout used by
2725 % \LaTeX{} but with the bottom skip bug corrected. This will be
2726 % the default when \cs{DocumentMetadata} is used; it can be
2727 % overwritten either through \pkg{footmisc} or by assigning any of
2728 % the other plugs (or by coding yet another plug for the socket).
2729 % \end{plugdecl}
2730 %
2731 % \begin{plugdecl}{footnotes-floats-legacy}
2732 % This implements the 2.09 layout (including its bottom skip bug).
2733 % \begin{macrocode}
2734 \NewSocketPlug {build/column/outputbox}{footnotes-floats-legacy} {%
2735 % \end{macrocode}
2736 % In the legacy case we don't really want to take out the bottom
2737 % skip, but rather than altering \cs{@outputbox@removebskip} in
2738 % \cs{makecol} to do nothing, which we would then have to undo in
2739 % every other layout, we immediately reinsert the dropped skip
2740 % again.
2741 %
2742 % In the legacy case there is, however, one other thing that needs
2743 % doing: if there was a \cs{vfil} at the bottom of the page (e.g.,
2744 % from \cs{newpage}) and there are no footnotes, then we need to back up
2745 % by the depth of the last line in the page box. Otherwise you
2746 % might end up with incorrect alignment if there is a higher-order
2747 % fill on the page (e.g., \cs{vfill}) that pushes the text material
2748 % to the bottom, since in such cases the depth will not be taken into
2749 % account by \TeX{}.
2750 %
2751 % This is done automatically by \cs{@outputbox@reinsertbskip} as
2752 % long as there are no footnotes waiting to be placed.
2753 % If there are footnotes, the operation is not done because by
2754 % default the \cs{skip}\cs{footins} separation is measured from the
2755 % bottom of the line not from the baseline.
2756 % But if the user has asked to change this behavior we should honor
2757 % it and that is done by putting the experimental socket
2758 % \socket{build/column/baselineattach} in which performs the
2759 % backing up if desired. This should happen only if footnotes are
2760 % actually present, so we test for this. Otherwise, there may be
2761 % bottom floats and the \cs{textfloatsep} should be measured
2762 % from the bottom of the last line and if not then any necessary
2763 % back up is done by \cs{@outputbox@reinsertbskip}.
2764 %
2765 % Note that after this code has backed up, the depth of
2766 % \cs{@outputbox} will be zero as there is a skip at its bottom. So
2767 % even if the same code is executed a second time (in
2768 % \cs{@outputbox@reinsertbskip} or in
2769 % \cs{@outputbox@appendfootnotes}) it will not alter the box further.
2770 %
2771 % \changes{v1.4r}{2025/03/25}{Add support for attaching footnotes
2772 % with a skip starting at the baseline of the last text line (footmisc/19)}
2773 % \begin{macrocode}
2774 \@if@footnotes@TF
2775 {\@outputbox@append{%
2776 \UseSocket{build/column/baselineattach}}%
2777 }{%
2778 % \end{macrocode}
2779 % If there are no footnotes but there are bottom floats we execute
2780 % the socket \socket{build/column/baselineattach} so that
2781 % \cs{textfloatsep} is measured from the baseline if that is being
2782 % asked for.
2783 % \changes{v1.4s}{2025/03/29}{Add socket (footmisc/19)}
2784 % \begin{macrocode}
2785 \@if@bottomfloats@TF
2786 {\@outputbox@append{%
2787 \UseSocket{build/column/baselineattach}}%
2788 }{}%
2789 }%
2790 \@outputbox@reinsertbskip
2791 \@outputbox@appendfootnotes
2792 \@outputbox@attachfloats
2793 }
2794 % \end{macrocode}
2795 % The \texttt{footnote-floats-legacy} plug is the default used by
2796 % \LaTeX{} when \cs{DocumentMetadata} is not used; it can be
2797 % overwritten
2798 % either through \pkg{footmisc} or
2799 % by assigning any of the other plugs (or by coding yet another
2800 % plug for the socket).
2801 % \begin{macrocode}
2802 \AssignSocketPlug {build/column/outputbox}{footnotes-floats-legacy}
2803 % \end{macrocode}
2804 % \end{plugdecl}
2805 %
2806 %
2807 %
2808 %
2809 % \begin{socketdecl}{build/column/footnotes}
2810 %
2811 % The socket allowing the manipulation of \cs{footins} box
2812 % (result needs to be moved back in there). Used when footnotes are
2813 % reformatted into a single paragraph by the
2814 % \texttt{para} option of \pkg{footmisc}. By default it does nothing.
2815 % \begin{macrocode}
2816 \NewSocket{build/column/footnotes}{0}
2817 % \end{macrocode}
2818 % \end{socketdecl}
2819 %
2820 %
2821 % \begin{socketdecl}{build/column/baselineattach}
2822 %
2823 % \changes{v1.4q}{2025/03/20}{Add experimental socket for baseline
2824 % attachment of footnotes -- subject to change (footmisc/19)}
2825 %
2826 % Socket that allows backing up by the depth of the
2827 % outputbox (but not more than \cs{maxdepth} before attaching any
2828 % footnotes or floats.
2829 % \begin{macrocode}
2830 \NewSocket{build/column/baselineattach}{0}
2831 % \end{macrocode}
2832 % \end{socketdecl}
2833 %
2834 % \begin{plugdecl}{on}
2835 % \begin{macrocode}
2836 \NewSocketPlug {build/column/baselineattach}{on} {%
2837 % \end{macrocode}
2838 % We do nothing if the depth is not positive, and we never back up
2839 % by more than \cs{maxdepth}.
2840 % \changes{v1.4r}{2025/03/25}{ (footmisc/19)}
2841 % \begin{macrocode}
2842 \@backup@outputbox@depth
2843 }
2844 % \end{macrocode}
2845 % \end{plugdecl}
2846 %
2847 % \begin{plugdecl}{off}
2848 % The \plug{off} plug is actually identical to the \plug{noop} plug
2849 % which is automatically made available; but offering that it under
2850 % the name \plug{off} makes the interface a bit nicer.
2851 % \begin{macrocode}
2852 \NewSocketPlug {build/column/baselineattach}{off}{}
2853 % \end{macrocode}
2854 % This feature is not turned on by default to preserve the behavior
2855 % of old documents.
2856 % With new documents using \cs{DocumentMetadata} it may become the
2857 % default.
2858 % \begin{macrocode}
2859 \AssignSocketPlug {build/column/baselineattach}{off}
2860 % \end{macrocode}
2861 % \end{plugdecl}
2862 %
2863 %
2864 %
2865 %
2866 %
2867 %
2868 %
2869 %
2870 % \begin{hookdecl}{build/page/before,
2871 % build/page/after}
2872 % \changes{v1.4m}{2025/02/14}{Hook added}
2873 % Hooks at the start and end of \cs{@outputpage} for use by packages.
2874 % \begin{macrocode}
2875 \NewMirroredHookPair{build/page/before}{build/page/after}
2876 % \end{macrocode}
2877 % \end{hookdecl}
2878 %
2879 %
2880 %
2881 % \begin{hookdecl}{build/page/reset}
2882 % \changes{v1.4m}{2025/02/14}{Hook added}
2883 % Hook in \cs{@outputpage} to reset special galley conventions
2884 % within the output routine. \LaTeX{} does a lot of resetting in
2885 % front of this hook, so by default it is empty. They are not made
2886 % part of the hook (which would have been possible) to ensure that
2887 % the kernel resets always come first and can be overwritten without the
2888 % need to apply hook rules unnecessarily.
2889 % \begin{macrocode}
2890 \NewHook {build/page/reset}
2891 % \end{macrocode}
2892 % \end{hookdecl}
2893 %
2894 %
2895 %
2896 % \begin{hookdecl}{build/column/before,build/column/after}
2897 % \changes{v1.4m}{2025/02/14}{Hook added}
2898 % Hooks at the start and end of \cs{@makecol} for use by packages.
2899 % \begin{macrocode}
2900 \NewMirroredHookPair{build/column/before}{build/column/after}
2901 % \end{macrocode}
2902 % \end{hookdecl}
2903 %
2904 %
2905 %
2906 % \begin{macrocode}
2907 %</2ekernel|latexrelease>
2908 %<latexrelease>\EndIncludeInRelease
2909 %<latexrelease>\IncludeInRelease{0000/00/00}%
2910 %<latexrelease> {\@makecol}{\@makecol adding hooks/sockets}%
2911 %<latexrelease>
2912 %<latexrelease>\gdef \@makecol {%
2913 %<latexrelease> \ifvoid\footins
2914 %<latexrelease> \setbox\@outputbox \box\@cclv
2915 %<latexrelease> \else
2916 %<latexrelease> \setbox\@outputbox \vbox {%
2917 %<latexrelease> \boxmaxdepth \@maxdepth
2918 %<latexrelease> \unvbox \@cclv
2919 %<latexrelease> \vskip \skip\footins
2920 %<latexrelease> \color@begingroup
2921 %<latexrelease> \normalcolor
2922 %<latexrelease> \footnoterule
2923 %<latexrelease> \unvbox \footins
2924 %<latexrelease> \color@endgroup
2925 %<latexrelease> }%
2926 %<latexrelease> \fi
2927 %<latexrelease> \let\@elt\relax
2928 %<latexrelease> \xdef\@freelist{\@freelist\@midlist}%
2929 %<latexrelease> \global \let \@midlist \@empty
2930 %<latexrelease> \@combinefloats
2931 %<latexrelease> \ifvbox\@kludgeins
2932 %<latexrelease> \@makespecialcolbox
2933 %<latexrelease> \else
2934 %<latexrelease> \setbox\@outputbox \vbox to\@colht {%
2935 %<latexrelease> \@texttop
2936 %<latexrelease> \dimen@ \dp\@outputbox
2937 %<latexrelease> \unvbox \@outputbox
2938 %<latexrelease> \vskip -\dimen@
2939 %<latexrelease> \@textbottom
2940 %<latexrelease> }%
2941 %<latexrelease> \fi
2942 %<latexrelease> \global \maxdepth \@maxdepth
2943 %<latexrelease>}
2944 %<latexrelease>
2945 %<latexrelease>\gdef \@makespecialcolbox {%
2946 %<latexrelease> \setbox\@outputbox \vbox {%
2947 %<latexrelease> \@texttop
2948 %<latexrelease> \dimen@ \dp\@outputbox
2949 %<latexrelease> \unvbox\@outputbox
2950 %<latexrelease> \vskip-\dimen@
2951 %<latexrelease> }%
2952 %<latexrelease> \@tempdima \@colht
2953 %<latexrelease> \ifdim \wd\@kludgeins>\z@
2954 %<latexrelease> \advance \@tempdima -\ht\@outputbox
2955 %<latexrelease> \advance \@tempdima \pageshrink
2956 %<latexrelease> \setbox\@outputbox \vbox to \@colht {%
2957 %<latexrelease> \unvbox\@outputbox
2958 %<latexrelease> \vskip \@tempdima
2959 %<latexrelease> \@textbottom
2960 %<latexrelease> }%
2961 %<latexrelease> \else
2962 %<latexrelease> \advance \@tempdima -\ht\@kludgeins
2963 %<latexrelease> \setbox \@outputbox \vbox to \@colht {%
2964 %<latexrelease> \vbox to \@tempdima {%
2965 %<latexrelease> \unvbox\@outputbox
2966 %<latexrelease> \@textbottom}%
2967 %<latexrelease> \vss}%
2968 %<latexrelease> \fi
2969 %<latexrelease> {\setbox \@tempboxa \box \@kludgeins}%
2970 %<latexrelease>}
2971 %<latexrelease>
2972 %<latexrelease> \let \@make@normalcolbox \@undefined
2973 %<latexrelease> \let \@make@specialcolbox \@undefined
2974 %<latexrelease> \let \@outputbox@removebskip \@undefined
2975 %<latexrelease> \let \@outputbox@reinsertbskip \@undefined
2976 %<latexrelease>
2977 %<latexrelease> \let \@outputbox@append \@undefined
2978 %<latexrelease> \let \@outputbox@appendfootnotes \@undefined
2979 %<latexrelease> \let \@outputbox@attachfloats \@undefined
2980 %<latexrelease> \let \@outputbox@attachtopfloats \@undefined
2981 %<latexrelease> \let \@outputbox@attachbottomfloats \@undefined
2982 %<latexrelease>
2983 % \end{macrocode}
2984 % If we roll back we also need to restore this definition.
2985 % \begin{macrocode}
2986 %<latexrelease> \def \@combinefloats {%
2987 %<latexrelease> \ifx \@toplist\@empty \else \@cflt \fi
2988 %<latexrelease> \ifx \@botlist\@empty \else \@cflb \fi
2989 %<latexrelease> }
2990 %<latexrelease>
2991 %<latexrelease> \let \@if@flushbottom@TF \@undefined
2992 %<latexrelease> \let \@if@footnotes@TF \@undefined
2993 %<latexrelease> \let \@if@bottomfloats@TF \@undefined
2994 %<latexrelease>
2995 %<latexrelease>\EndIncludeInRelease
2996 %<*2ekernel>
2997 % \end{macrocode}
2998 %
2999 % \begin{macro}{\@reinserts}
3000 % \changes{v1.0e}{1993/12/01}{Command added}
3001 % This is the code which reinserts the inserts. It puts them all
3002 % in one place; this can make some of them come out on the wrong
3003 % page.
3004 % It has been put into a separate macro to expedite experimentation.
3005 % \begin{macrocode}
3006 \gdef \@reinserts{%
3007 \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
3008 \ifvbox\@kludgeins\insert\@kludgeins
3009 {\unvbox\@kludgeins}\fi
3010 }
3011 % \end{macrocode}
3012 % \end{macro}
3013 %
3014 %
3015 %
3016 %
3017 % \begin{macro}{\@texttop}
3018 % \begin{macro}{\@textbottom}
3019 % These do nothing as a default.
3020 % \begin{macrocode}
3021 \let \@texttop \relax
3022 \let \@textbottom \relax
3023 % \end{macrocode}
3024 % \end{macro}
3025 % \end{macro}
3026 %
3027 % \begin{macro}{\@resetactivechars}
3028 % \begin{macro}{\@activechar@info}
3029 %
3030 % \changes{v1.0n}{1994/04/30}{\cs{@activechar@warning} changed to
3031 % \cs{@activechar@info}}
3032 % RmS 93/09/06:
3033 % added hook to protect against certain active characters in the
3034 % output routine. Default checks are for active space and end-of-line.
3035 % \changes{v1.0u}{1994/05/23}{Added \cs{MessageBreak}}
3036 % \begin{macrocode}
3037 \def\@activechar@info #1{%
3038 \@latex@info@no@line {Active #1 character found while
3039 output routine is active
3040 \MessageBreak
3041 This may be a bug in a package file
3042 you are using}%
3043 }
3044 % \end{macrocode}
3045 %
3046 % Do not put any spaces in this next bit!
3047 % \changes{1.2f}{1999/10/09}{Reset definition of active prime
3048 % character (used in math mode)}
3049 % \begin{macrocode}
3050 \begingroup
3051 \obeylines\obeyspaces%
3052 \catcode`\'\active%
3053 \gdef\@resetactivechars{%
3054 \def^^M{\@activechar@info{EOL}\space}%
3055 \def {\@activechar@info{space}\space}%
3056 \let'\active@math@prime}%
3057 \endgroup
3058 % \end{macrocode}
3059 % \end{macro}
3060 % \end{macro}
3061 %
3062 % \begin{macro}{\@outputpage}
3063 % \changes{v1.0f}{1993/12/05}{Command changed}
3064 % \begin{macro}{\@shipoutsetup}
3065 % \changes{v1.0f}{1993/12/05}{Command added}
3066 % \changes{v1.1s}{1995/11/10}{Command removed}
3067 % \begin{macro}{\@writesetup}
3068 % \changes{v1.1s}{1995/11/10}{Command removed}
3069 % \changes{v1.1o}{1995/07/21}{Command added}
3070 % \changes{v1.0f}{1993/12/05}{\cs{@startpagehook} added}
3071 % \changes{v1.0j}{1993/12/17}{---and then removed}
3072 % \changes{v1.0p}{1994/05/12}{\cs{normalcolor}added}
3073 % \changes{v1.0s}{1994/05/20}{Added setting of \cs{protect}
3074 % during \cs{shipout}.}
3075 % \changes{v1.0u}{1994/05/23}{Changed resetting of \cs{protect} after
3076 % shipout to use \cs{aftergroup}}
3077 % \changes{v1.1b}{1994/11/05}
3078 % {Use new \cs{color@hbox} concept.}
3079 % \changes{v1.1b}{1994/11/05}
3080 % {Change protect settings for new-style, protect-free
3081 % aux-files.}
3082 % \changes{v1.1c}{1994/11/05}
3083 % {Add new \cs{AtBeginDvi} concept}
3084 % \changes{v1.1e}{1994/11/10}
3085 % {Modify \cs{protect} setting}
3086 % \changes{v1.1f}{1994/11/14}
3087 % {Modify new \cs{AtBeginDvi} concept}
3088 % \changes{v1.1o}{1995/07/21}
3089 % {New, experimental, versions: need in-lining}
3090 % \changes{v1.1s}{1995/11/10}{In-lined}
3091 % \changes{v1.1w}{1996/09/21}{Added \cs{@parboxrestore} and made
3092 % consequent deletions: wait for the howls of protest}
3093 % \changes{v1.4m}{2025/02/14}{Hooks and sockets added}
3094 %
3095 % The |\color@hbox| hooks here are used to avoid putting just a
3096 % colour special into an otherwise empty box (in a header or
3097 % footer). These boxes are often set to be completely empty and so
3098 % adding a special produces a very underfull box message.
3099 %
3100 % There has been extensive tidying up of the old code here;
3101 % including the removal of a level of grouping.
3102 %
3103 % The setting of |\protect| immediately before the |\shipout|
3104 % is needed so that protected commands within |\write|s are
3105 % handled correctly.
3106 %
3107 % Within shipout's vbox it is reset to its default value, |\relax|.
3108 %
3109 % Resetting it to its default value after the shipout has been
3110 % completed (and the contents of the writes have been expanded)
3111 % must be done by use of |\aftergroup|.
3112 % This is because it must have the value |\relax|
3113 % before macros coming from other uses of |\aftergroup| within
3114 % this box are expanded.
3115 %
3116 % Putting this into the |\aftergroup| token list does not affect
3117 % the definition used in expanding the |\write|s because the
3118 % aftergroup token list is only constructed when popping the
3119 % save-stack, it is not expanded until after the shipout is
3120 % completed.
3121 %
3122 % Question: should things from an |\aftergroup| within the shipped
3123 % out box be executed in the environment set up for the writes, or
3124 % after it finishes?
3125 %
3126 % A lot of this code has been in-lined to prevent mis-use of
3127 % internal commands as hooks.
3128 % \begin{macrocode}
3129 %</2ekernel>
3130 %<latexrelease>\IncludeInRelease{2025/06/01}%
3131 %<latexrelease> {\@outputpage}{Use new mark mechanism}%
3132 %<*2ekernel|latexrelease>
3133 % \end{macrocode}
3134 % Temp definition to vanish again when something is offered by the backend:
3135 % \begin{macrocode}
3136 \protected \def \pdfannot@link@on@@ { \csname pdfannot_link_on:\endcsname }
3137 \protected \def \pdfannot@link@off@@ { \csname pdfannot_link_off:\endcsname }
3138 % \end{macrocode}
3139 %
3140 % \begin{macrocode}
3141 \def \@outputpage {%
3142 % \end{macrocode}
3143 % We start with a hook available to packages that want to prepend
3144 % code to \cs{@outputpage}.
3145 % \begin{macrocode}
3146 \UseHook {build/page/before}%
3147 % \end{macrocode}
3148 % The |\endgroup| is put in by |\aftergroup|.
3149 % \begin{macrocode}
3150 \begingroup
3151 % \end{macrocode}
3152 % Now all the set-up stuff has been in-lined for Frank.
3153 %
3154 % First the stuff for the writes.
3155 %
3156 % From here on was orginially in the command |\@writesetup|.
3157 %
3158 % RmS 93/08/19: Redefined accents to allow changes in font encoding;
3159 % but exactly why was this needed?
3160 %
3161 % \changes{v1.3c}{2017/03/10}{Reset \cs{language}}
3162 % Reset |\language| to the value current at |\begin{document}|.
3163 % In particular this ensures that a pagebreak in |verbatim| does not
3164 % prevent hyphenation in the page head.
3165 % \begin{macrocode}
3166 \language\document@default@language
3167 % \end{macrocode}
3168 %
3169 % Now a few more resets for things that may have changed during
3170 % galley processing. We start with resetting some active character definitions.
3171 % \begin{macrocode}
3172 \@resetactivechars
3173 % \end{macrocode}
3174 % Then we deal with catcodes that might got altered by
3175 % \texttt{verbatim} or similar environments and reset them to
3176 % standard values.
3177 % \changes{v1.4o}{2025/02/25}{Reset various catcodes to their default
3178 % values in case a pagebreak occurs while a special catcode scheme
3179 % is in force (gh/600)}
3180 % \changes{v1.4y}{2025/06/07}{Reset catcode of CR (gh/1766)}
3181 % \changes{v1.4y}{2025/06/08}{Reset catcode of TAB (gh/1766)}
3182 % \changes{v1.4z}{2025/08/22}{Don't use \cs{nfss@catcodes} + updates,
3183 % but spell everything out explicitly}
3184 % \begin{macrocode}
3185 \catcode`\\\z@
3186 \catcode`\{\@ne
3187 \catcode`\}\tw@
3188 \catcode`\$\thr@@
3189 \catcode`\&4\relax
3190 \catcode`\^^M5\relax
3191 \catcode`\#6\relax
3192 \catcode`\^7\relax
3193 \catcode`\_8\relax
3194 \catcode`\ 10\relax
3195 \catcode`\^^I10\relax
3196 \@makeother\<%
3197 \@makeother\>%
3198 \@makeother\*%
3199 \@makeother\.%
3200 \@makeother\-%
3201 \@makeother\/%
3202 \@makeother\[%
3203 \@makeother\]%
3204 \@makeother\`%
3205 \@makeother\'%
3206 \@makeother\"%
3207 \catcode`\~13\relax
3208 \catcode`\%14\relax
3209 % \end{macrocode}
3210 % If a page break happens between the start of a list and its first
3211 % item then |@newlist| will be true and this will mess up any list
3212 % that is used in the header or footer of the page. So we have to
3213 % reset that flag.
3214 % \changes{v1.2h}{2000/07/19}
3215 % {Reset and restore \cs{@if@newlist} for internal/3231}
3216 % \changes{v1.2j}{2001/01/07}
3217 % {And do it in the right macro! (pr/3286)}
3218 % \begin{macrocode}
3219 \global\let\@@if@newlist\if@newlist
3220 \global\@newlistfalse
3221 % \end{macrocode}
3222 %
3223 % \changes{v1.0q}{1994/05/16}{Changed setting of accents (FMi):
3224 % with the new encoding setup they can use \cs{let}.
3225 % It could also use the new internal commands?}
3226 % \changes{v1.1l}{1995/04/24}{Reset \cmd\\ latex/1451 (DPC)}
3227 % This next hook replaces the following:
3228 % \begin{verbatim}
3229 % \let\-\@dischyph
3230 % \let\'\@acci\let\`\@accii\let\=\@acciii
3231 % \let\\\@normalcr
3232 % \let\par\@@par %% 15 Sep 87 (this was once inside the box)
3233 % \end{verbatim}
3234 % and it does more than they did; in particular it sets:
3235 % \begin{verbatim}
3236 % \parindent\z@
3237 % \parskip\z@skip
3238 % \everypar{}%
3239 % \leftskip\z@skip
3240 % \rightskip\z@skip
3241 % \parfillskip\@flushglue
3242 % \lineskip\normallineskip
3243 % \baselineskip\normalbaselineskip
3244 % \sloppy
3245 % \end{verbatim}
3246 %
3247 % \begin{macrocode}
3248 \@parboxrestore
3249 % \end{macrocode}
3250 % \ldots\ to here was in the command |\@writesetup|.
3251 %
3252 % Hook to allow adding resets local to the output routine processing, e.g.,
3253 % in \cs{write} or running headers/footers, for packages that set
3254 % up special conventions in the main galley that should not leak
3255 % into the page production just because a page break happens in the
3256 % middle of such an environment.
3257 % \begin{macrocode}
3258 \UseHook {build/page/reset}%
3259 % \end{macrocode}
3260 %
3261 % The following definition of \cs{protect} is the one active during
3262 % the \cs{write} statement that migrate out of the \cs{shipout}
3263 % box, so even though it is immediately changed below (inside
3264 % \cs{shipout} it still has to be here!
3265 % \changes{v1.4z}{2025/08/22}{Move setting of \cs{protect} after all hooks
3266 % so that only the \cs{write} statements are affected (gh/1845)}
3267 % \begin{macrocode}
3268 \let \protect \noexpand
3269 % \end{macrocode}
3270 %
3271 % \begin{macrocode}
3272 \shipout \vbox{%
3273 % \end{macrocode}
3274 % Inside the \cs{shipout} box we have a different setting for \cs{protect}.
3275 % \begin{macrocode}
3276 \set@typeset@protect
3277 \aftergroup \endgroup
3278 % \end{macrocode}
3279 % Once the \cs{shipout} boxs ends \cs{protect} is again
3280 % \cs{noexpand} which is correct for any \cs{write} statements, but
3281 % once they are processed we want to get back to the following setting:
3282 % \begin{macrocode}
3283 \aftergroup \set@typeset@protect
3284 % \end{macrocode}
3285 %
3286 % Now the setup inside the shipped out box; this should contain all
3287 % the stuff that could only affect typesetting; other stuff may need
3288 % to be reset for the writes also.
3289 %
3290 % From here \ldots\ was in the command |\@shipoutsetup|.
3291 % \begin{macrocode}
3292 \if@specialpage
3293 \global \@specialpagefalse
3294 \@nameuse {ps@\@specialstyle}%
3295 \fi
3296 \if@twoside
3297 \ifodd\count\z@
3298 \let \@thehead \@oddhead
3299 \let \@thefoot \@oddfoot
3300 \let \@themargin \oddsidemargin
3301 \else
3302 \let \@thehead \@evenhead
3303 \let \@thefoot \@evenfoot
3304 \let \@themargin \evensidemargin
3305 \fi
3306 \fi
3307 % \end{macrocode}
3308 %
3309 % The rest was always inside the box.
3310 %
3311 % RmS 91/08/15: added this line:
3312 % \begin{macrocode}
3313 \reset@font
3314 % \end{macrocode}
3315 % RmS 93/08/06 Added |\lineskiplimit=0pt| to guard against it being
3316 % nonzero: e.g. by |\offinterlineskip| being in effect.
3317 %
3318 % There are probably lots of other things that may need resetting.
3319 %
3320 % \begin{macrocode}
3321 \normalsize
3322 % \end{macrocode}
3323 % Reset the space factors.
3324 % \changes{v1.2b}{1997/04/14}
3325 % {Call \cs{normalsfcodes} (from patch file) latex/2404}
3326 % \begin{macrocode}
3327 \normalsfcodes
3328 % \end{macrocode}
3329 %
3330 % Reset these here (previously reset separately for head and foot)
3331 % \changes{v1.2b}{1997/04/14}
3332 % {Move \cs{label} and \cs{index} (from patch file)}
3333 % \changes{v1.4l}{2025/01/21}{Support extended syntax
3334 % for \cs{label}, \cs{index}, and \cs{glossary} (gh/311)}
3335 % \changes{v1.4m}{2025/01/23}
3336 % {Make \cs{label}, \cs{index} and \cs{glossary} truely invisible
3337 % when typesetting (gh/1638)}
3338 % \begin{macrocode}
3339 \let \label \@gobble@with@sphack@om
3340 \let \index \@gobble@with@sphack@som
3341 \let \glossary \@gobble@with@sphack@om
3342 % \end{macrocode}
3343 %
3344 % \begin{macrocode}
3345 \baselineskip \z@skip
3346 \lineskip \z@skip
3347 \lineskiplimit \z@
3348 % \end{macrocode}
3349 % \ldots\ to here was in the command |\@shipoutsetup|.
3350 % \begin{macrocode}
3351 \@begindvi
3352 \vskip \topmargin
3353 \moveright\@themargin \vbox {%
3354 \setbox\@tempboxa \vbox to\headheight {%
3355 \vfil
3356 % \end{macrocode}
3357 % Tagging socket that receives the header in its second argument to
3358 % surround the header with appropriate tagging structures (first
3359 % argument is unused). If tagging is disabled it returns the
3360 % content of the second argument.
3361 % \begin{macrocode}
3362 \pdfannot@link@off@@
3363 \UseTaggingSocket{build/page/header}{}%
3364 {
3365 \color@hbox
3366 \normalcolor
3367 \hb@xt@ \textwidth {\@thehead }%
3368 \color@endbox
3369 }
3370 \pdfannot@link@on@@
3371 }
3372 \dp \@tempboxa \z@
3373 \box \@tempboxa
3374 \vskip \headsep
3375 \box \@outputbox
3376 \baselineskip \footskip
3377 % \end{macrocode}
3378 % Tagging socket that receives the footer in its second argument to
3379 % surround the footer with appropriate tagging structures (first
3380 % argument is unused). If tagging is disabled it returns the
3381 % content of the second argument.
3382 % \begin{macrocode}
3383 \pdfannot@link@off@@
3384 \UseTaggingSocket{build/page/footer}{}%
3385 {
3386 \color@hbox
3387 \normalcolor
3388 \hb@xt@ \textwidth {\@thefoot }%
3389 \color@endbox
3390 }
3391 \pdfannot@link@on@@
3392 }
3393 }
3394 % \end{macrocode}
3395 % |\endgroup| now inserted by |\aftergroup|
3396 %
3397 % Restore |\if@newlist|
3398 % \begin{macrocode}
3399 \global \let \if@newlist \@@if@newlist
3400 % \end{macrocode}
3401 %
3402 % \begin{macrocode}
3403 \global \@colht \textheight
3404 \stepcounter{page}%
3405 % \end{macrocode}
3406 % Another hook for packages that want to append material to \cs{@outputpage}.
3407 % \begin{macrocode}
3408 \UseHook {build/page/after}%
3409 }
3410 %<latexrelease>\EndIncludeInRelease
3411 % \end{macrocode}
3412 %
3413 % \begin{macrocode}
3414 %<latexrelease>\IncludeInRelease{2017/04/15}%
3415 %<latexrelease> {\@outputpage}{Reset language for hyphenation}%
3416 %<latexrelease>\def\@outputpage{%
3417 %<latexrelease>\begingroup
3418 %<latexrelease> \let \protect \noexpand
3419 %<latexrelease> \language\document@default@language
3420 %<latexrelease> \@resetactivechars
3421 %<latexrelease> \global\let\@@if@newlist\if@newlist
3422 %<latexrelease> \global\@newlistfalse
3423 %<latexrelease> \@parboxrestore
3424 %<latexrelease> \shipout \vbox{%
3425 %<latexrelease> \set@typeset@protect
3426 %<latexrelease> \aftergroup \endgroup
3427 %<latexrelease> \aftergroup \set@typeset@protect
3428 %<latexrelease> \if@specialpage
3429 %<latexrelease> \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
3430 %<latexrelease> \fi
3431 %<latexrelease> \if@twoside
3432 %<latexrelease> \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
3433 %<latexrelease> \let\@themargin\oddsidemargin
3434 %<latexrelease> \else \let\@thehead\@evenhead
3435 %<latexrelease> \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
3436 %<latexrelease> \fi
3437 %<latexrelease> \fi
3438 %<latexrelease> \reset@font
3439 %<latexrelease> \normalsize
3440 %<latexrelease> \normalsfcodes
3441 %<latexrelease> \let\label\@gobble
3442 %<latexrelease> \let\index\@gobble
3443 %<latexrelease> \let\glossary\@gobble
3444 %<latexrelease> \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
3445 %<latexrelease> \@begindvi
3446 %<latexrelease> \vskip \topmargin
3447 %<latexrelease> \moveright\@themargin \vbox {%
3448 %<latexrelease> \setbox\@tempboxa \vbox to\headheight{%
3449 %<latexrelease> \vfil
3450 %<latexrelease> \color@hbox
3451 %<latexrelease> \normalcolor
3452 %<latexrelease> \hb@xt@\textwidth{\@thehead}%
3453 %<latexrelease> \color@endbox
3454 %<latexrelease> }%
3455 %<latexrelease> \dp\@tempboxa \z@
3456 %<latexrelease> \box\@tempboxa
3457 %<latexrelease> \vskip \headsep
3458 %<latexrelease> \box\@outputbox
3459 %<latexrelease> \baselineskip \footskip
3460 %<latexrelease> \color@hbox
3461 %<latexrelease> \normalcolor
3462 %<latexrelease> \hb@xt@\textwidth{\@thefoot}%
3463 %<latexrelease> \color@endbox
3464 %<latexrelease> }%
3465 %<latexrelease> }%
3466 %<latexrelease> \global\let\if@newlist\@@if@newlist
3467 %<latexrelease> \global \@colht \textheight
3468 %<latexrelease> \stepcounter{page}%
3469 % \end{macrocode}
3470 % It is now clear that this does something useful (in the old mark
3471 % mechanism), thanks to Pieter van Oostrum pointing this out. It
3472 % is needed because a float page is made without using TeX's
3473 % page-builder; thus the output routine is never called so the
3474 % marks are not updated.
3475 % \begin{macrocode}
3476 %<latexrelease> \let\firstmark\botmark
3477 %<latexrelease>}
3478 %</2ekernel|latexrelease>
3479 %<latexrelease>\EndIncludeInRelease
3480 % \end{macrocode}
3481 %
3482 % \begin{macrocode}
3483 %<latexrelease>\IncludeInRelease{0000/00/00}%
3484 %<latexrelease> {\@outputpage}{Reset language for hyphenation}%
3485 %<latexrelease>\def\@outputpage{%
3486 %<latexrelease>\begingroup
3487 %<latexrelease> \let \protect \noexpand
3488 %<latexrelease> \@resetactivechars
3489 %<latexrelease> \global\let\@@if@newlist\if@newlist
3490 %<latexrelease> \global\@newlistfalse
3491 %<latexrelease> \@parboxrestore
3492 %<latexrelease> \shipout \vbox{%
3493 %<latexrelease> \set@typeset@protect
3494 %<latexrelease> \aftergroup \endgroup
3495 %<latexrelease> \aftergroup \set@typeset@protect
3496 %<latexrelease> \if@specialpage
3497 %<latexrelease> \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
3498 %<latexrelease> \fi
3499 %<latexrelease> \if@twoside
3500 %<latexrelease> \ifodd\count\z@
3501 %<latexrelease> \let\@thehead\@oddhead \let\@thefoot\@oddfoot
3502 %<latexrelease> \let\@themargin\oddsidemargin
3503 %<latexrelease> \else \let\@thehead\@evenhead
3504 %<latexrelease> \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
3505 %<latexrelease> \fi
3506 %<latexrelease> \fi
3507 %<latexrelease> \reset@font
3508 %<latexrelease> \normalsize
3509 %<latexrelease> \normalsfcodes
3510 %<latexrelease> \let\label\@gobble
3511 %<latexrelease> \let\index\@gobble
3512 %<latexrelease> \let\glossary\@gobble
3513 %<latexrelease> \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
3514 %<latexrelease> \@begindvi
3515 %<latexrelease> \vskip \topmargin
3516 %<latexrelease> \moveright\@themargin \vbox {%
3517 %<latexrelease> \setbox\@tempboxa \vbox to\headheight{%
3518 %<latexrelease> \vfil
3519 %<latexrelease> \color@hbox
3520 %<latexrelease> \normalcolor
3521 %<latexrelease> \hb@xt@\textwidth{\@thehead}%
3522 %<latexrelease> \color@endbox
3523 %<latexrelease> }%
3524 %<latexrelease> \dp\@tempboxa \z@
3525 %<latexrelease> \box\@tempboxa
3526 %<latexrelease> \vskip \headsep
3527 %<latexrelease> \box\@outputbox
3528 %<latexrelease> \baselineskip \footskip
3529 %<latexrelease> \color@hbox
3530 %<latexrelease> \normalcolor
3531 %<latexrelease> \hb@xt@\textwidth{\@thefoot}%
3532 %<latexrelease> \color@endbox
3533 %<latexrelease> }%
3534 %<latexrelease> }%
3535 %<latexrelease> \global\let\if@newlist\@@if@newlist
3536 %<latexrelease> \global \@colht \textheight
3537 %<latexrelease> \stepcounter{page}%
3538 %<latexrelease> \let\firstmark\botmark
3539 %<latexrelease>}
3540 %<latexrelease>\EndIncludeInRelease
3541 %<*2ekernel>
3542 % \end{macrocode}
3543 % \end{macro}
3544 % \end{macro}
3545 % \end{macro}
3546 %
3547 % \begin{macro}{\@begindvi}
3548 % \changes{v1.1c}{1994/11/05}
3549 % {Added macro}
3550 % \changes{v1.1f}{1994/11/14}{Use normal box register: why a box?}
3551 %
3552 % This unboxes stuff that must appear before anything else in the
3553 % |.dvi| file, then returns that box register to the free list and
3554 % cancels itself.
3555 %
3556 % The stuff in the box should not add any typeset material to the
3557 % page.
3558 % \begin{macrocode}
3559 \def \@begindvi{%
3560 \unvbox \@begindvibox
3561 \global\let \@begindvi \@empty
3562 }
3563 % \end{macrocode}
3564 % \end{macro}
3565 %
3566 %
3567 %
3568 %
3569 %
3570 %
3571 % \subsubsection{Dealing with floats}
3572 %
3573 %
3574 %
3575 % \begin{macro}{\@combinefloats}
3576 % \changes{v1.4m}{2025/02/14}{Macro got a new name}
3577 % Old name for what is now called \cs{@outputbox@attachfloats};
3578 % kept to support legacy packages.
3579 % \begin{macrocode}
3580 \let \@combinefloats \@outputbox@attachfloats
3581 % \end{macrocode}
3582 % \end{macro}
3583 %
3584 %
3585
3586 % \begin{macro}{\@cflt}
3587 % \changes{v1.0h}{1993/12/12}{name changed}
3588 % \begin{macro}{\@cflb}
3589 % The |\boxmaxdepth| setting here was not made local to
3590 % a box so was dangerous. It is needed only within the box made
3591 % by |\@cflt| (and not normally even there), so it has been
3592 % moved there; this also agrees with the original pseudocode.
3593 %
3594 % \changes{v1.0h}{1993/12/12}{boxmaxdepth setting moved}
3595 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
3596 % \begin{macrocode}
3597 \def \@cflt{%
3598 \let \@elt \@comflelt
3599 \setbox\@tempboxa \vbox{}%
3600 \@toplist
3601 \setbox\@outputbox \vbox{%
3602 \boxmaxdepth \maxdepth
3603 \unvbox\@tempboxa
3604 \vskip -\floatsep
3605 \topfigrule
3606 \vskip \textfloatsep
3607 \unvbox\@outputbox
3608 }%
3609 \let\@elt\relax
3610 \xdef\@freelist{\@freelist\@toplist}%
3611 \global\let\@toplist\@empty
3612 }
3613 % \end{macrocode}
3614 %
3615 % \begin{macrocode}
3616 \def \@cflb {%
3617 \let\@elt\@comflelt
3618 \setbox\@tempboxa \vbox{}%
3619 \@botlist
3620 \setbox\@outputbox \vbox{%
3621 \unvbox\@outputbox
3622 \vskip \textfloatsep
3623 \botfigrule
3624 \unvbox\@tempboxa
3625 \vskip -\floatsep
3626 }%
3627 \let\@elt\relax
3628 \xdef\@freelist{\@freelist\@botlist}%
3629 \global \let \@botlist\@empty
3630 }
3631 % \end{macrocode}
3632 % \end{macro}
3633 % \end{macro}
3634 %
3635 %
3636 % \begin{macro}{\@comflelt}
3637 % \begin{macro}{\@comdblflelt}
3638 % \begin{macro}{\@combinedblfloats}
3639 %
3640 % \begin{macrocode}
3641 \def\@comflelt#1{\setbox\@tempboxa
3642 \vbox{\unvbox\@tempboxa\box #1\vskip\floatsep}}
3643 % \end{macrocode}
3644 %
3645 % \begin{macrocode}
3646 \def\@comdblflelt#1{\setbox\@tempboxa
3647 \vbox{\unvbox\@tempboxa\box #1\vskip\dblfloatsep}}
3648 % \end{macrocode}
3649 %
3650 % \begin{macrocode}
3651 \def \@combinedblfloats{%
3652 \ifx \@dbltoplist \@empty
3653 \else
3654 \setbox\@tempboxa \vbox{}%
3655 \let \@elt \@comdblflelt
3656 \@dbltoplist
3657 \let \@elt \relax
3658 \xdef \@freelist {\@freelist\@dbltoplist}%
3659 \global\let \@dbltoplist \@empty
3660 \setbox\@outputbox \vbox to\textheight
3661 % \end{macrocode}
3662 %
3663 % The setting of |\boxmaxdepth| here has no effect since the
3664 % |\@outputbox| should already have depth zero. Even so, it would
3665 % have no effect on the layout of the page.
3666 % \changes{v1.0l}{1994/03/15}{Removed boxmaxdepth setting.}
3667 % \begin{macrocode}
3668 {%
3669 \unvbox\@tempboxa\vskip-\dblfloatsep
3670 % \end{macrocode}
3671 % Here we need different typesetting if the top float comes from
3672 % |\@topnewpage|.
3673 % \changes{v1.0n}{1994/04/30}{Removed rule in topnewpage case}
3674 % \begin{macrocode}
3675 \ifnum \@dbltopnum>\m@ne
3676 \dblfigrule
3677 \fi
3678 \vskip \dbltextfloatsep
3679 % \end{macrocode}
3680 % If pdf links are present in the galley and those links get broken
3681 % across pages they have to end up being on the same level of boxing
3682 % (even if not actually in the same structure) due to some engine
3683 % restrictions in pdf\TeX\ and Lua\TeX. We therefore unbox
3684 % |\@outputbox| here (which only contains a single |\hbox|) so that
3685 % this case has the same boxing level as a normal twocolumn page
3686 % without top floats.
3687 % \changes{v1.4d}{2018/11/28}{Unbox \cs{@outputbox} to preserve boxing
3688 % level (github/94)}
3689 % \begin{macrocode}
3690 \unvbox\@outputbox
3691 }%
3692 \fi
3693 }
3694 %</2ekernel>
3695 % \end{macrocode}
3696 % \end{macro}
3697 % \end{macro}
3698 % \end{macro}
3699 %
3700 %
3701 % \begin{macro}{\@startcolumn}
3702 % \changes{v1.0f}{1993/12/05}{Command changed}
3703 % \begin{macro}{\@startdblcolumn}
3704 % \changes{v1.0f}{1993/12/05}{Command changed}
3705 %
3706 % We could combine (most of) these two into |\@startcol <list>|.
3707 % Note that |\@xstartcol| was only used once (\ie in
3708 % |\@startcolumn|); it has therefore been removed. This is not quite
3709 % as efficient but it now has the same structure as
3710 % |\@startdblcolumn|.
3711 %
3712 % The empty-list test has been moved to |\@tryfcolumn|.
3713 %
3714 % \begin{macrocode}
3715 %<*2ekernel|fltrace>
3716 \def \@startcolumn {%
3717 \global \@colroom \@colht
3718 \@tryfcolumn \@deferlist
3719 \if@fcolmade
3720 %<*trace>
3721 \fl@trace{PAGE: float \if@twocolumn column \else page \fi
3722 completed}%
3723 %</trace>
3724 \else
3725 % \end{macrocode}
3726 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
3727 % \begin{macrocode}
3728 \begingroup
3729 \let \reserved@b \@deferlist
3730 \global \let \@deferlist \@empty
3731 \let \@elt \@scolelt
3732 \reserved@b
3733 \endgroup
3734 \fi
3735 }
3736 % \end{macrocode}
3737 %
3738 % This one does not need to set |\@colht|.
3739 %
3740 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
3741 % \begin{macrocode}
3742 %</2ekernel|fltrace>
3743 %<latexrelease|fltrace>\IncludeInRelease{2015/01/01}%
3744 %<latexrelease|fltrace> {\@startdblcolumn}{float order in 2-column}%
3745 %<*2ekernel|latexrelease|fltrace>
3746 \def \@startdblcolumn {%
3747 \@tryfcolumn \@deferlist
3748 \if@fcolmade
3749 %<fltrace> \fl@trace{PAGE: double float page completed}%
3750 \else
3751 \begingroup
3752 \let \reserved@b \@deferlist
3753 \global \let \@deferlist \@empty
3754 \let \@elt \@sdblcolelt
3755 \reserved@b
3756 \endgroup
3757 \fi
3758 }%
3759 %</2ekernel|latexrelease|fltrace>
3760 %<latexrelease|fltrace>\EndIncludeInRelease
3761 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
3762 %<latexrelease|fltrace> {\@startdblcolumn}{float order in 2-column}%
3763 %<latexrelease|fltrace>\def \@startdblcolumn {%
3764 % \end{macrocode}
3765 % Not needed since this always comes after |\@outputpage|:
3766 % \begin{macrocode}
3767 %<latexrelease|fltrace>% \global \@colht \textheight
3768 %<latexrelease|fltrace> \@tryfcolumn \@dbldeferlist
3769 %<latexrelease|fltrace> \if@fcolmade
3770 %<*trace>
3771 %<latexrelease|fltrace> \fl@trace{PAGE: double float page completed}%
3772 %</trace>
3773 %<latexrelease|fltrace> \else
3774 % \end{macrocode}
3775 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
3776 % \begin{macrocode}
3777 %<latexrelease|fltrace> \begingroup
3778 %<latexrelease|fltrace> \let \reserved@b \@dbldeferlist
3779 %<latexrelease|fltrace> \global \let \@dbldeferlist \@empty
3780 %<latexrelease|fltrace> \let \@elt \@sdblcolelt
3781 %<latexrelease|fltrace> \reserved@b
3782 %<latexrelease|fltrace> \endgroup
3783 %<latexrelease|fltrace> \fi
3784 %<latexrelease|fltrace>}%
3785 %<latexrelease|fltrace>\EndIncludeInRelease
3786 %<*2ekernel|fltrace>
3787 % \end{macrocode}
3788 % \end{macro}
3789 % \end{macro}
3790 %
3791 % \begin{macro}{\@tryfcolumn}
3792 % \changes{v1.0f}{1993/12/05}{Command changed}
3793 % Now tests if its list is empty before any further exertion.
3794 %
3795 % \begin{macrocode}
3796 \def \@tryfcolumn #1{%
3797 \global \@fcolmadefalse
3798 \ifx #1\@empty
3799 \else
3800 %<*trace>
3801 \fl@trace{PAGE: try float \if@twocolumn column/page\else page\fi
3802 ---\string #1}%
3803 \fl@trace{----- \string #1: #1}%
3804 %</trace>
3805 % \end{macrocode}
3806 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
3807 % \begin{macrocode}
3808 \xdef\@trylist{#1}%
3809 \global \let \@failedlist \@empty
3810 \begingroup
3811 \let \@elt \@xtryfc \@trylist
3812 \endgroup
3813 \if@fcolmade
3814 \@vtryfc #1%
3815 \fi
3816 \fi
3817 }
3818 %</2ekernel|fltrace>
3819 % \end{macrocode}
3820 %
3821 % \end{macro}
3822 %
3823 % \begin{macrocode}
3824 %<*2ekernel>
3825 % \end{macrocode}
3826 %
3827 % \begin{macro}{\@scolelt}
3828 % \begin{macrocode}
3829 \def\@scolelt#1{\def\@currbox{#1}\@addtonextcol}
3830 % \end{macrocode}
3831 % \end{macro}
3832 %
3833 % \begin{macro}{\@sdblcolelt}
3834 % \begin{macrocode}
3835 \def\@sdblcolelt#1{\def\@currbox{#1}\@addtodblcol}
3836 % \end{macrocode}
3837 % \end{macro}
3838 %
3839 % \begin{macro}{\@vtryfc}
3840 % \changes{v1.2d}{1997/11/19}{Reindent code, to be understandable(DPC).}
3841 % \begin{macrocode}
3842 \def\@vtryfc #1{%
3843 \global\setbox\@outputbox\vbox{}%
3844 \let\@elt\@wtryfc
3845 \@flsucceed
3846 \global\setbox\@outputbox \vbox to\@colht{%
3847 \vskip \@fptop
3848 \vskip -\@fpsep
3849 \unvbox \@outputbox
3850 \vskip \@fpbot}%
3851 \let\@elt\relax
3852 \xdef #1{\@failedlist\@flfail}%
3853 \xdef\@freelist{\@freelist\@flsucceed}}
3854 % \end{macrocode}
3855 % \end{macro}
3856 %
3857 % \begin{macro}{\@wtryfc}
3858 % \begin{macrocode}
3859 \def\@wtryfc #1{%
3860 \global\setbox\@outputbox\vbox{%
3861 \unvbox\@outputbox
3862 \vskip\@fpsep
3863 \box #1}}
3864 % \end{macrocode}
3865 % \end{macro}
3866 %
3867 % \begin{macro}{\@xtryfc}
3868 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
3869 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
3870 % \begin{macrocode}
3871 %</2ekernel>
3872 %<latexrelease>\IncludeInRelease{2015/01/01}{\@xtryfc}%
3873 %<latexrelease> {float order in 2-column}%
3874 %<*2ekernel|latexrelease>
3875 \def\@xtryfc #1{%
3876 \@next\reserved@a\@trylist{}{}%
3877 \@currtype \count #1%
3878 \divide\@currtype\@xxxii
3879 \multiply\@currtype\@xxxii
3880 \@bitor \@currtype \@failedlist
3881 \@testfp #1%
3882 % \end{macrocode}
3883 %
3884 % \begin{macrocode}
3885 \@testwrongwidth #1%
3886 % \end{macrocode}
3887 %
3888 % \begin{macrocode}
3889 \ifdim \ht #1>\@colht
3890 \@testtrue
3891 \fi
3892 \if@test
3893 \@cons\@failedlist #1%
3894 \else
3895 \@ytryfc #1%
3896 \fi}%
3897 %</2ekernel|latexrelease>
3898 %<latexrelease>\EndIncludeInRelease
3899 %<latexrelease>\IncludeInRelease{0000/00/00}{\@xtryfc}%
3900 %<latexrelease> {float order in 2-column}%
3901 %<latexrelease>\def\@xtryfc #1{%
3902 %<latexrelease> \@next\reserved@a\@trylist{}{}%
3903 %<latexrelease> \@currtype \count #1%
3904 %<latexrelease> \divide\@currtype\@xxxii
3905 %<latexrelease> \multiply\@currtype\@xxxii
3906 %<latexrelease> \@bitor \@currtype \@failedlist
3907 %<latexrelease> \@testfp #1%
3908 %<latexrelease> \ifdim \ht #1>\@colht
3909 %<latexrelease> \@testtrue
3910 %<latexrelease> \fi
3911 %<latexrelease> \if@test
3912 %<latexrelease> \@cons\@failedlist #1%
3913 %<latexrelease> \else
3914 %<latexrelease> \@ytryfc #1%
3915 %<latexrelease> \fi}%
3916 %<latexrelease>\EndIncludeInRelease
3917 %<*2ekernel>
3918 % \end{macrocode}
3919 % \end{macro}
3920 %
3921 % \begin{macro}{\@ytryfc}
3922 % \begin{macrocode}
3923 \def\@ytryfc #1{%
3924 \begingroup
3925 \gdef\@flsucceed{\@elt #1}%
3926 \global\let\@flfail\@empty
3927 \@tempdima\ht #1%
3928 \let\@elt\@ztryfc
3929 \@trylist
3930 \ifdim \@tempdima >\@fpmin
3931 \global\@fcolmadetrue
3932 \else
3933 \@cons\@failedlist #1%
3934 \fi
3935 \endgroup
3936 \if@fcolmade
3937 \let\@elt\@gobble
3938 \fi}
3939 % \end{macrocode}
3940 % \end{macro}
3941 %
3942 % \begin{macro}{\@ztryfc}
3943 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
3944 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
3945 % \begin{macrocode}
3946 %</2ekernel>
3947 %<latexrelease>\IncludeInRelease{2015/01/01}{@ztryfc}%
3948 %<latexrelease> {float order in 2-column}%
3949 %<*2ekernel|latexrelease>
3950 \def\@ztryfc #1{%
3951 \@tempcnta\count #1%
3952 \divide\@tempcnta\@xxxii
3953 \multiply\@tempcnta\@xxxii
3954 \@bitor \@tempcnta {\@failedlist \@flfail}%
3955 \@testfp #1%
3956 % \end{macrocode}
3957 %
3958 % not in fixfloats?
3959 % \begin{macrocode}
3960 \@testwrongwidth #1%
3961 % \end{macrocode}
3962 %
3963 % \begin{macrocode}
3964 \@tempdimb\@tempdima
3965 \advance\@tempdimb\ht #1%
3966 \advance\@tempdimb\@fpsep
3967 \ifdim \@tempdimb >\@colht
3968 \@testtrue
3969 \fi
3970 \if@test
3971 \@cons\@flfail #1%
3972 \else
3973 \@cons\@flsucceed #1%
3974 \@tempdima\@tempdimb
3975 \fi}%
3976 %</2ekernel|latexrelease>
3977 %<latexrelease>\EndIncludeInRelease
3978 %<latexrelease>\IncludeInRelease{0000/00/00}{@ztryfc}%
3979 %<latexrelease> {float order in 2-column}%
3980 %<latexrelease>\def\@ztryfc #1{%
3981 %<latexrelease> \@tempcnta \count#1%
3982 %<latexrelease> \divide\@tempcnta\@xxxii
3983 %<latexrelease> \multiply\@tempcnta\@xxxii
3984 %<latexrelease> \@bitor \@tempcnta {\@failedlist \@flfail}%
3985 %<latexrelease> \@testfp #1%
3986 %<latexrelease> \@tempdimb\@tempdima
3987 %<latexrelease> \advance\@tempdimb \ht#1%
3988 %<latexrelease> \advance\@tempdimb\@fpsep
3989 %<latexrelease> \ifdim \@tempdimb >\@colht
3990 %<latexrelease> \@testtrue
3991 %<latexrelease> \fi
3992 %<latexrelease> \if@test
3993 %<latexrelease> \@cons\@flfail #1%
3994 %<latexrelease> \else
3995 %<latexrelease> \@cons\@flsucceed #1%
3996 %<latexrelease> \@tempdima\@tempdimb
3997 %<latexrelease> \fi}%
3998 %<latexrelease>\EndIncludeInRelease
3999 % \end{macrocode}
4000 % \end{macro}
4001 %
4002 %
4003 % The major changes for float suppression and the changes to the float
4004 % mechanism to make it conform to the documentation are in these next
4005 % macros.
4006 %
4007 % \begin{macro}{\@addtobot}
4008 % \changes{v1.0f}{1993/12/05}{Command changed}
4009 % Lots of changes.
4010 %
4011 % \begin{macrocode}
4012 %<*2ekernel|fltrace>
4013 \def \@addtobot {%
4014 %<*trace>
4015 \fl@trace{***Start addtobot}%
4016 %</trace>
4017 \@getfpsbit 4\relax
4018 %<*trace>
4019 \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi bot:
4020 \the \@fpstype}%
4021 %</trace>
4022 \ifodd \@tempcnta
4023 \@flsetnum \@botnum
4024 \ifnum \@botnum>\z@
4025 \@tempswafalse
4026 \@flcheckspace \@botroom \@botlist
4027 \if@tempswa
4028 % \end{macrocode}
4029 % \changes{v1.4r}{2025/03/25}{Don't set \cs{maxdepth}
4030 % to zero any more (footmisc/19)}
4031 % \begin{macrocode}
4032 % \global \maxdepth \z@
4033 \@flupdates \@botnum \@botroom \@botlist
4034 %<*trace>
4035 \fl@trace{colroom (after-bot) = \the \@colroom}%
4036 \fl@trace{colnum (after-bot) = \the \@colnum}%
4037 \fl@trace{botnum (after-bot) = \the \@botnum}%
4038 \fl@trace{***Success: bot}%
4039 %</trace>
4040 \@inserttrue
4041 \fi
4042 %<*trace>
4043 \else
4044 \fl@trace{Fail: botnum = \the \@botnum:
4045 fpstype \the \@fpstype=ORD?}%
4046 \ifnum \@fpstype<\sixt@@n
4047 \fl@trace{ERROR: !b float not successful (addtobot)}%
4048 \fi
4049 %</trace>
4050 \fi
4051 \fi
4052 }
4053 % \end{macrocode}
4054 % \end{macro}
4055 %
4056 % \begin{macro}{\@addtotoporbot}
4057 % \changes{v1.0f}{1993/12/05}{Command changed}
4058 % Lots of changes.
4059 %
4060 % \begin{macrocode}
4061 \def \@addtotoporbot {%
4062 %<*trace>
4063 \fl@trace{***Start addtotoporbot}%
4064 %</trace>
4065 \@getfpsbit \tw@
4066 %<*trace>
4067 \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi top:
4068 \the \@fpstype}%
4069 %</trace>
4070 \ifodd \@tempcnta
4071 \@flsetnum \@topnum
4072 \ifnum \@topnum>\z@
4073 \@tempswafalse
4074 \@flcheckspace \@toproom \@toplist
4075 \if@tempswa
4076 \@bitor\@currtype{\@midlist\@botlist}%
4077 %<*trace>
4078 \fl@trace{(mid+bot)list: \@midlist, \@botlist:
4079 (addtotoporbot-before)}%
4080 %</trace>
4081 \if@test
4082 %<*trace>
4083 \fl@trace{type already on list: mid or bot---sent to addtobot}%
4084 %</trace>
4085 \else
4086 \@flupdates \@topnum \@toproom \@toplist
4087 %<*trace>
4088 \fl@trace{colroom (after-top) = \the \@colroom}%
4089 \fl@trace{colnum (after-top) = \the \@colnum}%
4090 \fl@trace{topnum (after-top) = \the \@topnum}%
4091 \fl@trace{***Success: top}%
4092 %</trace>
4093 \@inserttrue
4094 \fi
4095 \fi
4096 %<*trace>
4097 \else
4098 \fl@trace{Fail: topnum = \the \@topnum: fpstype
4099 \the \@fpstype=ORD?}%
4100 \ifnum \@fpstype<\sixt@@n
4101 \fl@trace{ERROR: !t float not successful (addtotoporbot)}%
4102 \fi
4103 %</trace>
4104 \fi
4105 \fi
4106 \if@insert
4107 \else
4108 %<*trace>
4109 \fl@trace{sent to addtobot (addtotoporbot)}%
4110 %</trace>
4111 \@addtobot
4112 \fi
4113 }
4114 %</2ekernel|fltrace>
4115 % \end{macrocode}
4116 % \end{macro}
4117 %
4118 % \begin{macro}{\@addtocurcol}
4119 % \changes{v1.0f}{1993/12/05}{Command changed}
4120 % \task{CAR}{Add rules around h floats for FMi}
4121 % \task{CAR}{Investigate pagebreak option possibilities}
4122 % Lots of changes.
4123 %
4124 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
4125 % \begin{macrocode}
4126 %<latexrelease|fltrace|flafter>\IncludeInRelease{2025/06/01}%
4127 %<latexrelease|fltrace|flafter> {\@addtocurcol}{float order in 2-column}%
4128 %<*2ekernel|latexrelease|fltrace|flafter>
4129 \def \@addtocurcol {%
4130 %<*trace>
4131 \fl@trace{***Start addtocurcol}%
4132 %</trace>
4133 \@insertfalse
4134 \@setfloattypecounts
4135 \ifnum \@fpstype=8
4136 %<*trace>
4137 \fl@trace{fpstype !p only (addtocurcol): \the \@fpstype = 8?}%
4138 %</trace>
4139 \else
4140 \ifnum \@fpstype=24
4141 %<*trace>
4142 \fl@trace{fpstype p only (addtocurcol): \the \@fpstype = 24?}%
4143 %</trace>
4144 \else
4145 \@flsettextmin
4146 % \end{macrocode}
4147 % This is a new adjustment which is quite a major change in
4148 % functionality; but it implements the documentation.
4149 % Note that |\@reqcolroom| will include the whole of the
4150 % page-so-far, and hence includes |\@textfloatsheight| of floats,
4151 % so before comparing it with |\@textmin|, we add this to
4152 % |\@textmin| also.
4153 % \begin{macrocode}
4154 %<*trace>
4155 \fl@trace{textfloatsheight (before) = \the \@textfloatsheight}%
4156 %</trace>
4157 \advance \@textmin \@textfloatsheight
4158 \@reqcolroom \@pageht
4159 % \end{macrocode}
4160 % This line must be removed since |\@specialoutput| changed.
4161 % \begin{macrocode}
4162 % \advance \@reqcolroom \@pagedp
4163 %<*trace>
4164 \fl@trace{textmin + textfloatsheight: \the \@textmin}%
4165 \fl@trace{page-so-far: \the \@reqcolroom}%
4166 %</trace>
4167 \ifdim \@textmin>\@reqcolroom
4168 \@reqcolroom \@textmin
4169 %<*trace>
4170 \fl@trace{ORD? textmin being used}%
4171 %</trace>
4172 \fi
4173 \advance \@reqcolroom \ht\@currbox
4174 % \end{macrocode}
4175 % We save the current value of \cs{@reqcolroom} so that we can
4176 % return to this value later, in case a test fails that may have added
4177 % something to it.
4178 % \changes{v1.4n}{2025/01/29}{Save current value of \cs{@reqcolroom} (gh/1645)}
4179 % \begin{macrocode}
4180 \saved@reqcolroom \@reqcolroom
4181 %<*trace>
4182 \fl@trace{float size = \the \ht \@currbox (addtocurcol)}%
4183 \fl@trace{colroom = \the \@colroom (addtocurcol)}%
4184 \fl@trace{reqcolroom = \the \@reqcolroom (addtocurcol)}%
4185 %</trace>
4186 \ifdim \@colroom>\@reqcolroom
4187 \@flsetnum \@colnum
4188 \ifnum \@colnum>\z@
4189 \@bitor\@currtype\@deferlist
4190 % \end{macrocode}
4191 % We need to defer the float also if its width
4192 % doesn't fit.
4193 % \changes{v1.2n}{2000/09/24}{FMi: test for wide float was
4194 % in wrong place}
4195 % \begin{macrocode}
4196 \@testwrongwidth\@currbox
4197 % \end{macrocode}
4198 %
4199 % \begin{macrocode}
4200 %<*trace>
4201 \fl@trace{deferlist: \@deferlist: (addtocurcol-before)}%
4202 %</trace>
4203 \if@test
4204 %<*trace>
4205 \fl@trace{type already on list: defer (addtocurcol)}%
4206 %</trace>
4207 \else
4208 \@bitor\@currtype\@botlist
4209 %<*trace>
4210 \fl@trace{botlist: \@botlist: (addtocurcol-before)}%
4211 %</trace>
4212 \if@test
4213 %<*trace>
4214 \fl@trace{type already on list: bot---sent to addtobot}%
4215 %</trace>
4216 \@addtobot
4217 \else
4218 %<*trace>
4219 \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi
4220 here: \the \@fpstype}%
4221 %</trace>
4222 \ifodd \count\@currbox
4223 \advance \@reqcolroom \intextsep
4224 \ifdim \@colroom>\@reqcolroom
4225 \global \advance \@colnum \m@ne
4226 \global \advance \@textfloatsheight \ht\@currbox
4227 % \end{macrocode}
4228 % This may sometimes give an overestimate.
4229 % \begin{macrocode}
4230 \global \advance \@textfloatsheight 2\intextsep
4231 \@cons \@midlist \@currbox
4232 %<*trace>
4233 \fl@trace{***Success: here}%
4234 \fl@trace{textfloatsheight (after-here) =
4235 \the \@textfloatsheight}%
4236 \fl@trace{colnum (after-here) = \the \@colnum}%
4237 %</trace>
4238 % \end{macrocode}
4239 %
4240 % CHANGE TO |\@addtocurcol|:
4241 %
4242 % |\penalty\z@| changed to |\penalty\interlinepenalty| so |\samepage|
4243 % works properly with figure and table environments.
4244 % (Changed 23 Oct 86)
4245 %
4246 % There is also an |\addpenalty\interlinepenalty| above.
4247 %
4248 % Although it is best to use |\addvspace| in case two h floats come
4249 % together, this makes other spacing more difficult to adjust; whereas
4250 % if a user specifies two h floats together then they can more easily
4251 % get the spacing correct by ad hoc commands.
4252 %
4253 % It is necessary to adjust for the addition of |\parskip| here in
4254 % case the float is added between paragraphs (\ie when in vertical
4255 % mode).
4256 %
4257 % If the nobreak switch is true we need to reset it and clear
4258 % |\everypar| since the float may not reset the flag and cannot reset
4259 % the |\everypar| globally.
4260 % \changes{v1.0l}{1994/03/15}{Changed \cs{addvspace} to \cs{vskip}}
4261 % \changes{v1.1i}{1994/11/21}
4262 % {Added \cs{if@nobreak} test before float box}
4263 % \changes{v1.1z}{1996/10/24}{Added \cs{nobreak}, etc as appropriate}
4264 %
4265 % Typesetting starts here (we are in vertical mode).
4266 % \begin{macrocode}
4267 \if@nobreak
4268 \nobreak
4269 \@nobreakfalse
4270 \everypar{}%
4271 \else
4272 \addpenalty \interlinepenalty
4273 \fi
4274 \vskip \intextsep
4275 \box\@currbox
4276 \penalty\interlinepenalty
4277 \vskip\intextsep
4278 \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
4279 % \end{macrocode}
4280 % Typesetting ends here.
4281 % \begin{macrocode}
4282 \outputpenalty \z@
4283 \@inserttrue
4284 %<*trace>
4285 \else
4286 \fl@trace{Fail---no room at 2nd test of colroom
4287 (addtocorcol \string\intextsep)}%
4288 %</trace>
4289 \fi
4290 \fi
4291 \if@insert
4292 \else
4293 % \end{macrocode}
4294 % Next set of docstrip guards are a bit weird, essentially
4295 % |\@addtotoporbot| ends up inside the kernel and the
4296 % \texttt{fltrace} package and |\@addtobot| shows up in the
4297 % \texttt{flafter} package. Guess that could have been done a bit
4298 % more obvious :-)
4299 % \begin{macrocode}
4300 %<*2ekernel|fltrace|latexrelease>
4301 %<*trace>
4302 \fl@trace{not here: sent to addtotoporbot}%
4303 %</trace>
4304 \@addtotoporbot
4305 %</2ekernel|fltrace|latexrelease>
4306 %<*!2ekernel&!fltrace&!latexrelease>
4307 %<*trace>
4308 \fl@trace{not here: sent to addtobot}%
4309 %</trace>
4310 \@addtobot
4311 %</!2ekernel&!fltrace&!latexrelease>
4312 \fi
4313 \fi
4314 \fi
4315 %<*trace>
4316 \else
4317 \fl@trace{Fail: colnum = \the \@colnum:
4318 fpstype \the \@fpstype=ORD?}%
4319 \ifnum \@fpstype<\sixt@@n
4320 \fl@trace{ERROR: BANG float not successful (addtocurcol)}%
4321 \fi
4322 %</trace>
4323 \fi
4324 %<*trace>
4325 \else
4326 \fl@trace{Fail---no room: fl box ht: \the \ht \@currbox
4327 (addtocurcol)}%
4328 %</trace>
4329 \fi
4330 \fi
4331 \fi
4332 \if@insert
4333 \else
4334 \@resethfps
4335 %<*trace>
4336 \fl@trace{put on deferlist (addtocurcol)}%
4337 %</trace>
4338 \@cons\@deferlist\@currbox
4339 %<*trace>
4340 \fl@trace{deferlist: \@deferlist: (addtocurcol-after)}%
4341 %</trace>
4342 \fi
4343 }%
4344 %</2ekernel|latexrelease|fltrace|flafter>
4345 %<latexrelease|fltrace|flafter>\EndIncludeInRelease
4346 % \end{macrocode}
4347 % The rollback code is rather complicated as it has to account for
4348 % the fact that we roll back not just the kernel but also the
4349 % packages \pkg{flafter} and \pkg{fltrace}.
4350 % \begin{macrocode}
4351 %<latexrelease|fltrace|flafter>\IncludeInRelease{2015/01/01}%
4352 %<latexrelease|fltrace|flafter> {\@addtocurcol}{float order in 2-column}%
4353 %<latexrelease|fltrace|flafter>\def \@addtocurcol {%
4354 %<*trace>
4355 %<latexrelease|fltrace|flafter> \fl@trace{***Start addtocurcol}%
4356 %</trace>
4357 %<latexrelease|fltrace|flafter> \@insertfalse
4358 %<latexrelease|fltrace|flafter> \@setfloattypecounts
4359 %<latexrelease|fltrace|flafter> \ifnum \@fpstype=8
4360 %<*trace>
4361 %<latexrelease|fltrace|flafter> \fl@trace{fpstype !p only (addtocurcol): \the \@fpstype = 8?}%
4362 %</trace>
4363 %<latexrelease|fltrace|flafter> \else
4364 %<latexrelease|fltrace|flafter> \ifnum \@fpstype=24
4365 %<*trace>
4366 %<latexrelease|fltrace|flafter> \fl@trace{fpstype p only (addtocurcol): \the \@fpstype = 24?}%
4367 %</trace>
4368 %<latexrelease|fltrace|flafter> \else
4369 %<latexrelease|fltrace|flafter> \@flsettextmin
4370 %<*trace>
4371 %<latexrelease|fltrace|flafter> \fl@trace{textfloatsheight (before) = \the \@textfloatsheight}%
4372 %</trace>
4373 %<latexrelease|fltrace|flafter> \advance \@textmin \@textfloatsheight
4374 %<latexrelease|fltrace|flafter> \@reqcolroom \@pageht
4375 %<*trace>
4376 %<latexrelease|fltrace|flafter> \fl@trace{textmin + textfloatsheight: \the \@textmin}%
4377 %<latexrelease|fltrace|flafter> \fl@trace{page-so-far: \the \@reqcolroom}%
4378 %</trace>
4379 %<latexrelease|fltrace|flafter> \ifdim \@textmin>\@reqcolroom
4380 %<latexrelease|fltrace|flafter> \@reqcolroom \@textmin
4381 %<*trace>
4382 %<latexrelease|fltrace|flafter> \fl@trace{ORD? textmin being used}%
4383 %</trace>
4384 %<latexrelease|fltrace|flafter> \fi
4385 %<latexrelease|fltrace|flafter> \advance \@reqcolroom \ht\@currbox
4386 %<*trace>
4387 %<latexrelease|fltrace|flafter> \fl@trace{float size = \the \ht \@currbox (addtocurcol)}%
4388 %<latexrelease|fltrace|flafter> \fl@trace{colroom = \the \@colroom (addtocurcol)}%
4389 %<latexrelease|fltrace|flafter> \fl@trace{reqcolroom = \the \@reqcolroom (addtocurcol)}%
4390 %</trace>
4391 %<latexrelease|fltrace|flafter> \ifdim \@colroom>\@reqcolroom
4392 %<latexrelease|fltrace|flafter> \@flsetnum \@colnum
4393 %<latexrelease|fltrace|flafter> \ifnum \@colnum>\z@
4394 %<latexrelease|fltrace|flafter> \@bitor\@currtype\@deferlist
4395 %<latexrelease|fltrace|flafter> \@testwrongwidth\@currbox
4396 %<*trace>
4397 %<latexrelease|fltrace|flafter> \fl@trace{deferlist: \@deferlist: (addtocurcol-before)}%
4398 %</trace>
4399 %<latexrelease|fltrace|flafter> \if@test
4400 %<*trace>
4401 %<latexrelease|fltrace|flafter> \fl@trace{type already on list: defer (addtocurcol)}%
4402 %</trace>
4403 %<latexrelease|fltrace|flafter> \else
4404 %<latexrelease|fltrace|flafter> \@bitor\@currtype\@botlist
4405 %<*trace>
4406 %<latexrelease|fltrace|flafter> \fl@trace{botlist: \@botlist: (addtocurcol-before)}%
4407 %</trace>
4408 %<latexrelease|fltrace|flafter> \if@test
4409 %<*trace>
4410 %<latexrelease|fltrace|flafter> \fl@trace{type already on list: bot---sent to addtobot}%
4411 %</trace>
4412 %<latexrelease|fltrace|flafter> \@addtobot
4413 %<latexrelease|fltrace|flafter> \else
4414 %<*trace>
4415 %<latexrelease|fltrace|flafter> \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi
4416 %<latexrelease|fltrace|flafter> here: \the \@fpstype}%
4417 %</trace>
4418 %<latexrelease|fltrace|flafter> \ifodd \count\@currbox
4419 %<latexrelease|fltrace|flafter> \advance \@reqcolroom \intextsep
4420 %<latexrelease|fltrace|flafter> \ifdim \@colroom>\@reqcolroom
4421 %<latexrelease|fltrace|flafter> \global \advance \@colnum \m@ne
4422 %<latexrelease|fltrace|flafter> \global \advance \@textfloatsheight \ht\@currbox
4423 %<latexrelease|fltrace|flafter> \global \advance \@textfloatsheight 2\intextsep
4424 %<latexrelease|fltrace|flafter> \@cons \@midlist \@currbox
4425 %<*trace>
4426 %<latexrelease|fltrace|flafter> \fl@trace{***Success: here}%
4427 %<latexrelease|fltrace|flafter> \fl@trace{textfloatsheight (after-here) =
4428 %<latexrelease|fltrace|flafter> \the \@textfloatsheight}%
4429 %<latexrelease|fltrace|flafter> \fl@trace{colnum (after-here) = \the \@colnum}%
4430 %</trace>
4431 %<latexrelease|fltrace|flafter> \if@nobreak
4432 %<latexrelease|fltrace|flafter> \nobreak
4433 %<latexrelease|fltrace|flafter> \@nobreakfalse
4434 %<latexrelease|fltrace|flafter> \everypar{}%
4435 %<latexrelease|fltrace|flafter> \else
4436 %<latexrelease|fltrace|flafter> \addpenalty \interlinepenalty
4437 %<latexrelease|fltrace|flafter> \fi
4438 %<latexrelease|fltrace|flafter> \vskip \intextsep
4439 %<latexrelease|fltrace|flafter> \box\@currbox
4440 %<latexrelease|fltrace|flafter> \penalty\interlinepenalty
4441 %<latexrelease|fltrace|flafter> \vskip\intextsep
4442 %<latexrelease|fltrace|flafter> \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
4443 %<latexrelease|fltrace|flafter> \outputpenalty \z@
4444 %<latexrelease|fltrace|flafter> \@inserttrue
4445 %<*trace>
4446 %<latexrelease|fltrace|flafter> \else
4447 %<latexrelease|fltrace|flafter> \fl@trace{Fail---no room at 2nd test of colroom
4448 %<latexrelease|fltrace|flafter> (addtocorcol \string\intextsep)}%
4449 %</trace>
4450 %<latexrelease|fltrace|flafter> \fi
4451 %<latexrelease|fltrace|flafter> \fi
4452 %<latexrelease|fltrace|flafter> \if@insert
4453 %<latexrelease|fltrace|flafter> \else
4454 %<*trace>
4455 %<fltrace|latexrelease> \fl@trace{not here: sent to addtotoporbot}%
4456 %</trace>
4457 %<fltrace|latexrelease> \@addtotoporbot
4458 %<*trace>
4459 %<flafter> \fl@trace{not here: sent to addtobot}%
4460 %</trace>
4461 %<flafter> \@addtobot
4462 %<latexrelease|fltrace|flafter> \fi
4463 %<latexrelease|fltrace|flafter> \fi
4464 %<latexrelease|fltrace|flafter> \fi
4465 %<*trace>
4466 %<latexrelease|fltrace|flafter> \else
4467 %<latexrelease|fltrace|flafter> \fl@trace{Fail: colnum = \the \@colnum:
4468 %<latexrelease|fltrace|flafter> fpstype \the \@fpstype=ORD?}%
4469 %<latexrelease|fltrace|flafter> \ifnum \@fpstype<\sixt@@n
4470 %<latexrelease|fltrace|flafter> \fl@trace{ERROR: BANG float not successful (addtocurcol)}%
4471 %<latexrelease|fltrace|flafter> \fi
4472 %</trace>
4473 %<latexrelease|fltrace|flafter> \fi
4474 %<*trace>
4475 %<latexrelease|fltrace|flafter> \else
4476 %<latexrelease|fltrace|flafter> \fl@trace{Fail---no room: fl box ht: \the \ht \@currbox
4477 %<latexrelease|fltrace|flafter> (addtocurcol)}%
4478 %</trace>
4479 %<latexrelease|fltrace|flafter> \fi
4480 %<latexrelease|fltrace|flafter> \fi
4481 %<latexrelease|fltrace|flafter> \fi
4482 %<latexrelease|fltrace|flafter> \if@insert
4483 %<latexrelease|fltrace|flafter> \else
4484 %<latexrelease|fltrace|flafter> \@resethfps
4485 %<*trace>
4486 %<latexrelease|fltrace|flafter> \fl@trace{put on deferlist (addtocurcol)}%
4487 %</trace>
4488 %<latexrelease|fltrace|flafter> \@cons\@deferlist\@currbox
4489 %<*trace>
4490 %<latexrelease|fltrace|flafter> \fl@trace{deferlist: \@deferlist: (addtocurcol-after)}%
4491 %</trace>
4492 %<latexrelease|fltrace|flafter> \fi
4493 %<latexrelease|fltrace|flafter>}%
4494 % \end{macrocode}
4495 %
4496 % \begin{macrocode}
4497 %<latexrelease|fltrace|flafter>\EndIncludeInRelease
4498 %<latexrelease|fltrace|flafter>\IncludeInRelease{0000/00/00}%
4499 %<latexrelease|fltrace|flafter> {\@addtocurcol}{float order in 2-column}%
4500 %<latexrelease|fltrace|flafter>\def \@addtocurcol {%
4501 %<*trace>
4502 %<latexrelease|fltrace|flafter> \fl@trace{***Start addtocurcol}%
4503 %</trace>
4504 %<latexrelease|fltrace|flafter> \@insertfalse
4505 %<latexrelease|fltrace|flafter> \@setfloattypecounts
4506 %<latexrelease|fltrace|flafter> \ifnum \@fpstype=8
4507 %<*trace>
4508 %<latexrelease|fltrace|flafter> \fl@trace{fpstype !p only (addtocurcol):
4509 %<latexrelease|fltrace|flafter> \the \@fpstype = 8?}%
4510 %</trace>
4511 %<latexrelease|fltrace|flafter> \else
4512 %<latexrelease|fltrace|flafter> \ifnum \@fpstype=24
4513 %<*trace>
4514 %<latexrelease|fltrace|flafter> \fl@trace{fpstype p only (addtocurcol):
4515 %<latexrelease|fltrace|flafter> \the \@fpstype = 24?}%
4516 %</trace>
4517 %<latexrelease|fltrace|flafter> \else
4518 %<latexrelease|fltrace|flafter> \@flsettextmin
4519 % \end{macrocode}
4520 % This is a new adjustment which is quite a major change in
4521 % functionality; but it implements the documentation.
4522 % Note that |\@reqcolroom| will include the whole of the
4523 % page-so-far, and hence includes |\@textfloatsheight| of floats,
4524 % so before comparing it with |\@textmin|, we add this to
4525 % |\@textmin| also.
4526 % \begin{macrocode}
4527 %<*trace>
4528 %<latexrelease|fltrace|flafter> \fl@trace{textfloatsheight (before) =
4529 %<latexrelease|fltrace|flafter> \the \@textfloatsheight}%
4530 %</trace>
4531 %<latexrelease|fltrace|flafter> \advance \@textmin \@textfloatsheight
4532 %<latexrelease|fltrace|flafter> \@reqcolroom \@pageht
4533 % \end{macrocode}
4534 % This line must be removed since |\@specialoutput| changed.
4535 % \begin{macrocode}
4536 % \advance \@reqcolroom \@pagedp
4537 %<*trace>
4538 %<latexrelease|fltrace|flafter> \fl@trace{textmin + textfloatsheight:
4539 %<latexrelease|fltrace|flafter> \the \@textmin}%
4540 %<latexrelease|fltrace|flafter> \fl@trace{page-so-far: \the \@reqcolroom}%
4541 %<latexrelease|fltrace|flafter>
4542 %</trace>
4543 %<latexrelease|fltrace|flafter> \ifdim \@textmin>\@reqcolroom
4544 %<latexrelease|fltrace|flafter> \@reqcolroom \@textmin
4545 %<*trace>
4546 %<latexrelease|fltrace|flafter> \fl@trace{ORD? textmin being used}%
4547 %</trace>
4548 %<latexrelease|fltrace|flafter> \fi
4549 %<latexrelease|fltrace|flafter> \advance \@reqcolroom \ht\@currbox
4550 %<*trace>
4551 %<latexrelease|fltrace|flafter> \fl@trace{float size =
4552 %<latexrelease|fltrace|flafter> \the \ht \@currbox (addtocurcol)}%
4553 %<latexrelease|fltrace|flafter> \fl@trace{colroom =
4554 %<latexrelease|fltrace|flafter> \the \@colroom (addtocurcol)}%
4555 %<latexrelease|fltrace|flafter> \fl@trace{reqcolroom =
4556 %<latexrelease|fltrace|flafter> \the \@reqcolroom (addtocurcol)}%
4557 %</trace>
4558 %<latexrelease|fltrace|flafter> \ifdim \@colroom>\@reqcolroom
4559 %<latexrelease|fltrace|flafter> \@flsetnum \@colnum
4560 %<latexrelease|fltrace|flafter> \ifnum \@colnum>\z@
4561 %<latexrelease|fltrace|flafter> \@bitor\@currtype\@deferlist
4562 %<*trace>
4563 %<latexrelease|fltrace|flafter> \fl@trace{deferlist:
4564 %<latexrelease|fltrace|flafter> \@deferlist: (addtocurcol-before)}%
4565 %</trace>
4566 %<latexrelease|fltrace|flafter> \if@test
4567 %<*trace>
4568 %<latexrelease|fltrace|flafter> \fl@trace{type already on list:
4569 %<latexrelease|fltrace|flafter> defer (addtocurcol)}%
4570 %</trace>
4571 %<latexrelease|fltrace|flafter> \else
4572 %<latexrelease|fltrace|flafter> \@bitor\@currtype\@botlist
4573 %<*trace>
4574 %<latexrelease|fltrace|flafter> \fl@trace{botlist: \@botlist:
4575 %<latexrelease|fltrace|flafter> (addtocurcol-before)}%
4576 %</trace>
4577 %<latexrelease|fltrace|flafter> \if@test
4578 %<*trace>
4579 %<latexrelease|fltrace|flafter> \fl@trace{type already on list:
4580 %<latexrelease|fltrace|flafter> bot---sent to addtobot}%
4581 %</trace>
4582 %<latexrelease|fltrace|flafter> \@addtobot
4583 %<latexrelease|fltrace|flafter> \else
4584 %<*trace>
4585 %<latexrelease|fltrace|flafter> \fl@trace{fpstype
4586 %<latexrelease|fltrace|flafter> \ifodd \@tempcnta OK \else not \fi
4587 %<latexrelease|fltrace|flafter> here: \the \@fpstype}%
4588 %</trace>
4589 %<latexrelease|fltrace|flafter> \ifodd \count\@currbox
4590 %<latexrelease|fltrace|flafter> \advance \@reqcolroom \intextsep
4591 %<latexrelease|fltrace|flafter> \ifdim \@colroom>\@reqcolroom
4592 %<latexrelease|fltrace|flafter> \global \advance \@colnum \m@ne
4593 %<latexrelease|fltrace|flafter> \global \advance
4594 %<latexrelease|fltrace|flafter> \@textfloatsheight\ht\@currbox
4595 % \end{macrocode}
4596 % This may sometimes give an overestimate.
4597 % \begin{macrocode}
4598 %<latexrelease|fltrace|flafter> \global \advance
4599 %<latexrelease|fltrace|flafter> \@textfloatsheight 2\intextsep
4600 %<latexrelease|fltrace|flafter> \@cons \@midlist \@currbox
4601 %<*trace>
4602 %<latexrelease|fltrace|flafter> \fl@trace{***Success: here}%
4603 %<latexrelease|fltrace|flafter> \fl@trace{textfloatsheight
4604 %<latexrelease|fltrace|flafter> (after-here) =
4605 %<latexrelease|fltrace|flafter> \the \@textfloatsheight}%
4606 %<latexrelease|fltrace|flafter> \fl@trace{colnum (after-here) =
4607 %<latexrelease|fltrace|flafter> \the \@colnum}%
4608 %</trace>
4609 % \end{macrocode}
4610 %
4611 % CHANGE TO |\@addtocurcol|:
4612 %
4613 % |\penalty\z@| changed to |\penalty\interlinepenalty| so |\samepage|
4614 % works properly with figure and table environments.
4615 % (Changed 23 Oct 86)
4616 %
4617 % There is also an |\addpenalty\interlinepenalty| above.
4618 %
4619 % Although it is best to use |\addvspace| in case two h floats come
4620 % together, this makes other spacing more difficult to adjust; whereas
4621 % if a user specifies two h floats together then they can more easily
4622 % get the spacing correct by ad hoc commands.
4623 %
4624 % It is necessary to adjust for the addition of |\parskip| here in
4625 % case the float is added between paragraphs (\ie when in vertical
4626 % mode).
4627 %
4628 % If the nobreak switch is true we need to reset it and clear
4629 % |\everypar| since the float may not reset the flag and cannot reset
4630 % the |\everypar| globally.
4631 % \changes{v1.0l}{1994/03/15}{Changed \cs{addvspace} to \cs{vskip}}
4632 % \changes{v1.1i}{1994/11/21}
4633 % {Added \cs{if@nobreak} test before float box}
4634 % \changes{v1.1z}{1996/10/24}{Added \cs{nobreak}, etc as appropriate}
4635 %
4636 % Typesetting starts here (we are in vertical mode).
4637 % \begin{macrocode}
4638 %<latexrelease|fltrace|flafter> \if@nobreak
4639 %<latexrelease|fltrace|flafter> \nobreak
4640 %<latexrelease|fltrace|flafter> \@nobreakfalse
4641 %<latexrelease|fltrace|flafter> \everypar{}%
4642 %<latexrelease|fltrace|flafter> \else
4643 %<latexrelease|fltrace|flafter> \addpenalty\interlinepenalty
4644 %<latexrelease|fltrace|flafter> \fi
4645 %<latexrelease|fltrace|flafter> \vskip \intextsep
4646 %<latexrelease|fltrace|flafter> \box\@currbox
4647 %<latexrelease|fltrace|flafter> \penalty\interlinepenalty
4648 %<latexrelease|fltrace|flafter> \vskip\intextsep
4649 %<latexrelease|fltrace|flafter> \ifnum\outputpenalty
4650 %<latexrelease|fltrace|flafter> <-\@Mii \vskip
4651 %<latexrelease|fltrace|flafter> -\parskip\fi
4652 % \end{macrocode}
4653 % Typesetting ends here.
4654 % \begin{macrocode}
4655 %<latexrelease|fltrace|flafter> \outputpenalty \z@
4656 %<latexrelease|fltrace|flafter> \@inserttrue
4657 %<*trace>
4658 %<latexrelease|fltrace|flafter> \else
4659 %<latexrelease|fltrace|flafter> \fl@trace{Fail---no room at 2nd test of colroom
4660 %<latexrelease|fltrace|flafter> (addtocorcol \string\intextsep)}%
4661 %</trace>
4662 %<latexrelease|fltrace|flafter> \fi
4663 %<latexrelease|fltrace|flafter> \fi
4664 %<latexrelease|fltrace|flafter> \if@insert
4665 %<latexrelease|fltrace|flafter> \else
4666 % \end{macrocode}
4667 % Next set of docstrip guards are a bit weird, essentially
4668 % |\@addtotoporbot| ends up inside the kernel and the
4669 % \texttt{fltrace} package and |\@addtotoporbot| shows up in the
4670 % \texttt{flafter} package. Guess that could have been done a bit
4671 % more obvious :-)
4672 % \begin{macrocode}
4673 %<*2ekernel|fltrace>
4674 %<*trace>
4675 %<latexrelease|fltrace|flafter> \fl@trace{not here: sent to addtotoporbot}%
4676 %</trace>
4677 %<latexrelease|fltrace|flafter> \@addtotoporbot
4678 %</2ekernel|fltrace>
4679 %<*!2ekernel&!autoload&!fltrace>
4680 %<*trace>
4681 %<latexrelease|fltrace|flafter> \fl@trace{not here: sent to addtobot}%
4682 %</trace>
4683 %<latexrelease|fltrace|flafter> \@addtobot
4684 %</!2ekernel&!autoload&!fltrace>
4685 %<latexrelease|fltrace|flafter> \fi
4686 %<latexrelease|fltrace|flafter> \fi
4687 %<latexrelease|fltrace|flafter> \fi
4688 %<*trace>
4689 %<latexrelease|fltrace|flafter> \else
4690 %<latexrelease|fltrace|flafter> \fl@trace{Fail: colnum = \the \@colnum:
4691 %<latexrelease|fltrace|flafter> fpstype \the \@fpstype=ORD?}%
4692 %<latexrelease|fltrace|flafter> \ifnum \@fpstype<\sixt@@n
4693 %<latexrelease|fltrace|flafter> \fl@trace{ERROR: BANG float not successful
4694 %<latexrelease|fltrace|flafter> (addtocurcol)}%
4695 %<latexrelease|fltrace|flafter> \fi
4696 %</trace>
4697 %<latexrelease|fltrace|flafter> \fi
4698 %<*trace>
4699 %<latexrelease|fltrace|flafter> \else
4700 %<latexrelease|fltrace|flafter> \fl@trace{Fail---no room: fl box ht:
4701 %<latexrelease|fltrace|flafter> \the \ht \@currbox (addtocurcol)}%
4702 %</trace>
4703 %<latexrelease|fltrace|flafter> \fi
4704 %<latexrelease|fltrace|flafter> \fi
4705 %<latexrelease|fltrace|flafter> \fi
4706 %<latexrelease|fltrace|flafter> \if@insert
4707 %<latexrelease|fltrace|flafter> \else
4708 %<latexrelease|fltrace|flafter> \@resethfps
4709 %<*trace>
4710 %<latexrelease|fltrace|flafter> \fl@trace{put on deferlist (addtocurcol)}%
4711 %</trace>
4712 %<latexrelease|fltrace|flafter> \@cons\@deferlist\@currbox
4713 %<*trace>
4714 %<latexrelease|fltrace|flafter> \fl@trace{deferlist: \@deferlist:
4715 %<latexrelease|fltrace|flafter> (addtocurcol-after)}%
4716 %</trace>
4717 %<latexrelease|fltrace|flafter> \fi
4718 %<latexrelease|fltrace|flafter> }%
4719 %<latexrelease|fltrace|flafter>\EndIncludeInRelease
4720 % \end{macrocode}
4721 % \end{macro}
4722 %
4723 % \begin{macro}{\@addtonextcol}
4724 % \changes{v1.0f}{1993/12/05}{Command changed}
4725 % Lots of changes.
4726 %
4727 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
4728 % \changes{v1.4b}{2017/12/17}{fix doc guards}
4729 % \begin{macrocode}
4730 %<latexrelease|fltrace>\IncludeInRelease{2025/06/01}
4731 %<latexrelease|fltrace> {\@addtonextcol}{float order in 2-column}%
4732 %<*2ekernel|latexrelease|fltrace>
4733 \def\@addtonextcol{%
4734 \begingroup
4735 %<*trace>
4736 \fl@trace{***Start addtonextcol}%
4737 %</trace>
4738 \@insertfalse
4739 \@setfloattypecounts
4740 \ifnum \@fpstype=8
4741 %<*trace>
4742 \fl@trace{fpstype not curcol: \the \@fpstype = 8?}%
4743 %</trace>
4744 \else
4745 \ifnum \@fpstype=24
4746 %<*trace>
4747 \fl@trace{fpstype not curcol: \the \@fpstype = 24?}%
4748 %</trace>
4749 \else
4750 \@flsettextmin
4751 %<*trace>
4752 \fl@trace{text-so-far: 0pt (top of col)}%
4753 %</trace>
4754 \@reqcolroom \ht\@currbox
4755 %<*trace>
4756 \fl@trace{float size: \the \@reqcolroom (addtonextcol)}%
4757 %</trace>
4758 \advance \@reqcolroom \@textmin
4759 % \end{macrocode}
4760 %
4761 % \changes{v1.4n}{2025/01/29}{Save current value of \cs{@reqcolroom} (gh/1645)}
4762 % \begin{macrocode}
4763 \saved@reqcolroom \@reqcolroom
4764 %<*trace>
4765 \fl@trace{colroom = \the \@colroom (addtonextcol)}%
4766 \fl@trace{reqcolroom = \the \@reqcolroom (addtonextcol)}%
4767 %</trace>
4768 \ifdim \@colroom>\@reqcolroom
4769 \@flsetnum \@colnum
4770 \ifnum\@colnum>\z@
4771 \@bitor\@currtype\@deferlist
4772 %<*trace>
4773 \fl@trace{deferlist: \@deferlist: (addtonextcol-before)}%
4774 %</trace>
4775 % \end{macrocode}
4776 %
4777 % \begin{macrocode}
4778 \@testwrongwidth\@currbox
4779 % \end{macrocode}
4780 %
4781 % \begin{macrocode}
4782 \if@test
4783 %<*trace>
4784 \fl@trace{type already on list: defer (addtonextcol)}%
4785 %</trace>
4786 \else
4787 %<*trace>
4788 \fl@trace{sent to addtotoporbot (addtonextcol)}%
4789 %</trace>
4790 \@addtotoporbot
4791 \fi
4792 \fi
4793 %<*trace>
4794 \else
4795 \fl@trace{Fail---no room: fl box ht: \the \ht \@currbox
4796 (addtonextcol)}%
4797 %</trace>
4798 \fi
4799 \fi
4800 \fi
4801 \if@insert
4802 \else
4803 %<*trace>
4804 \fl@trace{put back on deferlist (addtonextcol)}%
4805 %</trace>
4806 \@cons\@deferlist\@currbox
4807 %<*trace>
4808 \fl@trace{deferlist: \@deferlist: (addtonextcol-after)}%
4809 %</trace>
4810 \fi
4811 %<*trace>
4812 \fl@trace{End of addtonextcol -- locally counts:}%
4813 \fl@trace{col: \the\@colnum. top: \the \@topnum. bot: \the \@botnum.}%
4814 %</trace>
4815 \endgroup
4816 %<*trace>
4817 \fl@trace{End of addtonextcol -- globally counts:}%
4818 \fl@trace{col: \the\@colnum. top: \the \@topnum. bot: \the \@botnum.}%
4819 %</trace>
4820 }%
4821 %</2ekernel|latexrelease|fltrace>
4822 %<latexrelease|fltrace>\EndIncludeInRelease
4823 % \end{macrocode}
4824 %
4825 % \begin{macrocode}
4826 %<latexrelease|fltrace>\IncludeInRelease{2015/01/01}
4827 %<latexrelease|fltrace> {\@addtonextcol}{float order in 2-column}%
4828 %<latexrelease|fltrace>\def\@addtonextcol{%
4829 %<latexrelease|fltrace> \begingroup
4830 %<*trace>
4831 %<latexrelease|fltrace> \fl@trace{***Start addtonextcol}%
4832 %</trace>
4833 %<latexrelease|fltrace> \@insertfalse
4834 %<latexrelease|fltrace> \@setfloattypecounts
4835 %<latexrelease|fltrace> \ifnum \@fpstype=8
4836 %<*trace>
4837 %<latexrelease|fltrace> \fl@trace{fpstype not curcol: \the \@fpstype = 8?}%
4838 %</trace>
4839 %<latexrelease|fltrace> \else
4840 %<latexrelease|fltrace> \ifnum \@fpstype=24
4841 %<*trace>
4842 %<latexrelease|fltrace> \fl@trace{fpstype not curcol: \the \@fpstype = 24?}%
4843 %</trace>
4844 %<latexrelease|fltrace> \else
4845 %<latexrelease|fltrace> \@flsettextmin
4846 %<*trace>
4847 %<latexrelease|fltrace> \fl@trace{text-so-far: 0pt (top of col)}%
4848 %</trace>
4849 %<latexrelease|fltrace> \@reqcolroom \ht\@currbox
4850 %<*trace>
4851 %<latexrelease|fltrace> \fl@trace{float size: \the \@reqcolroom (addtonextcol)}%
4852 %</trace>
4853 %<latexrelease|fltrace> \advance \@reqcolroom \@textmin
4854 %<*trace>
4855 %<latexrelease|fltrace> \fl@trace{colroom = \the \@colroom (addtonextcol)}%
4856 %<latexrelease|fltrace> \fl@trace{reqcolroom = \the \@reqcolroom (addtonextcol)}%
4857 %</trace>
4858 %<latexrelease|fltrace> \ifdim \@colroom>\@reqcolroom
4859 %<latexrelease|fltrace> \@flsetnum \@colnum
4860 %<latexrelease|fltrace> \ifnum\@colnum>\z@
4861 %<latexrelease|fltrace> \@bitor\@currtype\@deferlist
4862 %<*trace>
4863 %<latexrelease|fltrace> \fl@trace{deferlist: \@deferlist: (addtonextcol-before)}%
4864 %</trace>
4865 %<latexrelease|fltrace> \@testwrongwidth\@currbox
4866 %<latexrelease|fltrace> \if@test
4867 %<*trace>
4868 %<latexrelease|fltrace> \fl@trace{type already on list: defer (addtonextcol)}%
4869 %</trace>
4870 %<latexrelease|fltrace> \else
4871 %<*trace>
4872 %<latexrelease|fltrace> \fl@trace{sent to addtotoporbot (addtonextcol)}%
4873 %</trace>
4874 %<latexrelease|fltrace> \@addtotoporbot
4875 %<latexrelease|fltrace> \fi
4876 %<latexrelease|fltrace> \fi
4877 %<*trace>
4878 %<latexrelease|fltrace> \else
4879 %<latexrelease|fltrace> \fl@trace{Fail---no room: fl box ht: \the \ht \@currbox
4880 %<latexrelease|fltrace> (addtonextcol)}%
4881 %</trace>
4882 %<latexrelease|fltrace> \fi
4883 %<latexrelease|fltrace> \fi
4884 %<latexrelease|fltrace> \fi
4885 %<latexrelease|fltrace> \if@insert
4886 %<latexrelease|fltrace> \else
4887 %<*trace>
4888 %<latexrelease|fltrace> \fl@trace{put back on deferlist (addtonextcol)}%
4889 %</trace>
4890 %<latexrelease|fltrace> \@cons\@deferlist\@currbox
4891 %<*trace>
4892 %<latexrelease|fltrace> \fl@trace{deferlist: \@deferlist: (addtonextcol-after)}%
4893 %</trace>
4894 %<latexrelease|fltrace> \fi
4895 %<*trace>
4896 %<latexrelease|fltrace> \fl@trace{End of addtonextcol -- locally counts:}%
4897 %<latexrelease|fltrace> \fl@trace{col: \the\@colnum. top: \the \@topnum. bot: \the \@botnum.}%
4898 %</trace>
4899 %<latexrelease|fltrace> \endgroup
4900 %<*trace>
4901 %<latexrelease|fltrace> \fl@trace{End of addtonextcol -- globally counts:}%
4902 %<latexrelease|fltrace> \fl@trace{col: \the\@colnum. top: \the \@topnum. bot: \the \@botnum.}%
4903 %</trace>
4904 %<latexrelease|fltrace>}%
4905 %<latexrelease|fltrace>\EndIncludeInRelease
4906 % \end{macrocode}
4907 %
4908 % \begin{macrocode}
4909 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
4910 %<latexrelease|fltrace> {\@addtonextcol}{float order in 2-column}%
4911 %<latexrelease|fltrace>\def\@addtonextcol{%
4912 %<latexrelease|fltrace> \begingroup
4913 %<*trace>
4914 %<latexrelease|fltrace> \fl@trace{***Start addtonextcol}%
4915 %</trace>
4916 %<latexrelease|fltrace> \@insertfalse
4917 %<latexrelease|fltrace> \@setfloattypecounts
4918 %<latexrelease|fltrace> \ifnum \@fpstype=8
4919 %<*trace>
4920 %<latexrelease|fltrace> \fl@trace{fpstype not curcol:
4921 %<latexrelease|fltrace> \the \@fpstype = 8?}%
4922 %</trace>
4923 %<latexrelease|fltrace> \else
4924 %<latexrelease|fltrace> \ifnum \@fpstype=24
4925 %<*trace>
4926 %<latexrelease|fltrace> \fl@trace{fpstype not curcol:
4927 %<latexrelease|fltrace> \the \@fpstype = 24?}%
4928 %</trace>
4929 %<latexrelease|fltrace> \else
4930 %<latexrelease|fltrace> \@flsettextmin
4931 %<*trace>
4932 %<latexrelease|fltrace> \fl@trace{text-so-far: 0pt (top of col)}%
4933 %</trace>
4934 %<latexrelease|fltrace> \@reqcolroom \ht\@currbox
4935 %<*trace>
4936 %<latexrelease|fltrace> \fl@trace{float size:
4937 %<latexrelease|fltrace> \the \@reqcolroom (addtonextcol)}%
4938 %<latexrelease|fltrace>
4939 %</trace>
4940 %<latexrelease|fltrace> \advance \@reqcolroom \@textmin
4941 %<*trace>
4942 %<latexrelease|fltrace> \fl@trace{colroom =
4943 %<latexrelease|fltrace> \the \@colroom (addtonextcol)}%
4944 %<latexrelease|fltrace> \fl@trace{reqcolroom =
4945 %<latexrelease|fltrace> \the \@reqcolroom (addtonextcol)}%
4946 %</trace>
4947 %<latexrelease|fltrace> \ifdim \@colroom>\@reqcolroom
4948 %<latexrelease|fltrace> \@flsetnum \@colnum
4949 %<latexrelease|fltrace> \ifnum\@colnum>\z@
4950 %<latexrelease|fltrace> \@bitor\@currtype\@deferlist
4951 %<*trace>
4952 %<latexrelease|fltrace> \fl@trace{deferlist: \@deferlist:
4953 %<latexrelease|fltrace> (addtonextcol-before)}%
4954 %</trace>
4955 %<latexrelease|fltrace> \if@test
4956 %<*trace>
4957 %<latexrelease|fltrace> \fl@trace{type already on list:
4958 %<latexrelease|fltrace> defer (addtonextcol)}%
4959 %</trace>
4960 %<latexrelease|fltrace> \else
4961 %<*trace>
4962 %<latexrelease|fltrace> \fl@trace{sent to addtotoporbot
4963 %<latexrelease|fltrace> (addtonextcol)}%
4964 %</trace>
4965 %<latexrelease|fltrace> \@addtotoporbot
4966 %<latexrelease|fltrace> \fi
4967 %<latexrelease|fltrace> \fi
4968 %<*trace>
4969 %<latexrelease|fltrace> \else
4970 %<latexrelease|fltrace> \fl@trace{Fail---no room: fl box ht:
4971 %<latexrelease|fltrace> \the \ht \@currbox (addtonextcol)}%
4972 %</trace>
4973 %<latexrelease|fltrace> \fi
4974 %<latexrelease|fltrace> \fi
4975 %<latexrelease|fltrace> \fi
4976 %<latexrelease|fltrace> \if@insert
4977 %<latexrelease|fltrace> \else
4978 %<*trace>
4979 %<latexrelease|fltrace> \fl@trace{put back on deferlist
4980 %<latexrelease|fltrace> (addtonextcol)}%
4981 %</trace>
4982 %<latexrelease|fltrace> \@cons\@deferlist\@currbox
4983 %<*trace>
4984 %<latexrelease|fltrace> \fl@trace{deferlist: \@deferlist:
4985 %<latexrelease|fltrace> (addtonextcol-after)}%
4986 %</trace>
4987 %<latexrelease|fltrace> \fi
4988 %<*trace>
4989 %<latexrelease|fltrace> \fl@trace{End of addtonextcol --
4990 %<latexrelease|fltrace> locally counts:}%
4991 %<latexrelease|fltrace> \fl@trace{col: \the \@colnum.
4992 %<latexrelease|fltrace> top: \the \@topnum. bot: \the \@botnum.}%
4993 %</trace>
4994 %<latexrelease|fltrace> \endgroup
4995 %<*trace>
4996 %<latexrelease|fltrace> \fl@trace{End of addtonextcol --
4997 %<latexrelease|fltrace> globally counts:}%
4998 %<latexrelease|fltrace> \fl@trace{col: \the \@colnum.
4999 %<latexrelease|fltrace> top: \the \@topnum. bot: \the \@botnum.}%
5000 %</trace>
5001 %<latexrelease|fltrace>}%
5002 %<latexrelease|fltrace>\EndIncludeInRelease
5003 % \end{macrocode}
5004 %
5005 % \end{macro}
5006 %
5007 % \begin{macro}{\@addtodblcol}
5008 % \changes{v1.0f}{1993/12/05}{Command changed}
5009 % Lots of changes.
5010 %
5011 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
5012 % \begin{macrocode}
5013 %<latexrelease|fltrace>\IncludeInRelease{2015/01/01}%
5014 %<latexrelease|fltrace> {\@addtodblcol}{float order in 2-column}%
5015 %<*2ekernel|latexrelease|fltrace>
5016 \def\@addtodblcol{%
5017 \begingroup
5018 %<*trace>
5019 \fl@trace{***Start addtodblcol}%
5020 %</trace>
5021 \@insertfalse
5022 \@setfloattypecounts
5023 \@getfpsbit \tw@
5024 %<*trace>
5025 \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi dbltop:
5026 \the \@fpstype}%
5027 %</trace>
5028 \ifodd\@tempcnta
5029 \@flsetnum \@dbltopnum
5030 \ifnum \@dbltopnum>\z@
5031 \@tempswafalse
5032 \ifdim \@dbltoproom>\ht\@currbox
5033 \@tempswatrue
5034 %<*trace>
5035 \fl@trace{Space OK: \@dbltoproom =
5036 \the \@dbltoproom > \the \ht \@currbox
5037 (dbltoproom)}%
5038 %</trace>
5039 \else
5040 %<*trace>
5041 \fl@trace{fpstype: \the \@fpstype (addtodblcol)}%
5042 %</trace>
5043 \ifnum \@fpstype<\sixt@@n
5044 %<*trace>
5045 \fl@trace{BANG float ignoring \@dbltoproom}%
5046 \fl@trace{\@spaces \@dbltoproom = \the \@dbltoproom.
5047 Ht float: \the \ht \@currbox-BANG}%
5048 %</trace>
5049 % \end{macrocode}
5050 % Need to check that there is room on the page, using the local value
5051 % of |\@textmin| to make the necessary adjustment to |\@dbltoproom|.
5052 % \begin{macrocode}
5053 \advance \@dbltoproom \@textmin
5054 %<*trace>
5055 \fl@trace{Local value of texmin: \the\@textmin}%
5056 \fl@trace{\@spaces space on page = \the \@dbltoproom.
5057 Ht float: \the \ht \@currbox-BANG}%
5058 %</trace>
5059 \ifdim \@dbltoproom>\ht\@currbox
5060 \@tempswatrue
5061 %<*trace>
5062 \fl@trace{Space OK BANG: space on page =
5063 \the \@dbltoproom > \the \ht \@currbox}%
5064 \else
5065 \fl@trace{fpstype: \the \@fpstype}%
5066 \fl@trace{Fail---no room dbltoproom-BANG?:}%
5067 \fl@trace{\@spaces space on page = \the \@dbltoproom.
5068 Ht float: \the \ht \@currbox}%
5069 %</trace>
5070 \fi
5071 \advance \@dbltoproom -\@textmin
5072 %<*trace>
5073 \else
5074 \fl@trace{fpstype: \the \@fpstype}%
5075 \fl@trace{Fail---no room dbltoproom-ORD?:}%
5076 \fl@trace{\@spaces \@dbltoproom = \the \@dbltoproom.
5077 Ht float: \the \ht \@currbox}%
5078 %</trace>
5079 \fi
5080 \fi
5081 \if@tempswa
5082 \@bitor \@currtype \@deferlist
5083 %<*trace>
5084 \fl@trace{(dbl)deferlist: \@deferlist: (before)}%
5085 %</trace>
5086 % \end{macrocode}
5087 %
5088 % not in fixfloats?
5089 % \begin{macrocode}
5090 \@testwrongwidth\@currbox
5091 % \end{macrocode}
5092 %
5093 % \begin{macrocode}
5094 \if@test
5095 %<*trace>
5096 \fl@trace{type already on list: (dbl)defer}%
5097 %</trace>
5098 \else
5099 \@tempdima -\ht\@currbox
5100 \advance\@tempdima
5101 -\ifx \@dbltoplist\@empty \dbltextfloatsep \else
5102 \dblfloatsep \fi
5103 \global \advance \@dbltoproom \@tempdima
5104 \global \advance \@colht \@tempdima
5105 \global \advance \@dbltopnum \m@ne
5106 \@cons \@dbltoplist \@currbox
5107 %<*trace>
5108 \fl@trace{dbltopnum (after) = \the \@dbltopnum}%
5109 \fl@trace{***Success: dbltop}%
5110 %</trace>
5111 \@inserttrue
5112 \fi
5113 \fi
5114 %<*trace>
5115 \else
5116 \fl@trace{Fail: dbltopnum = \the \@dbltopnum: fpstype
5117 \the \@fpstype=ORD?}%
5118 \ifnum \@fpstype<\sixt@@n
5119 \fl@trace{ERROR: !t float not successful (addtodblcol)}%
5120 \fi
5121 %</trace>
5122 \fi
5123 \fi
5124 \if@insert
5125 \else
5126 %<*trace>
5127 \fl@trace{put on deferlist}%
5128 %</trace>
5129 \@cons\@deferlist\@currbox
5130 %<*trace>
5131 \fl@trace{(dbl)deferlist: \@deferlist: (after)}%
5132 %</trace>
5133 \fi
5134 %<*trace>
5135 \fl@trace{End of addtodblcol -- locally count:}%
5136 \fl@trace{ dbltop: \the \@dbltopnum.}%
5137 %</trace>
5138 \endgroup
5139 %<*trace>
5140 \fl@trace{End of addtodblcol -- globally count:}%
5141 \fl@trace{dbltop: \the \@dbltopnum.}%
5142 %</trace>
5143 }%
5144 %</2ekernel|latexrelease|fltrace>
5145 %<latexrelease|fltrace>\EndIncludeInRelease
5146 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
5147 %<latexrelease|fltrace> {\@addtodblcol}{float order in 2-column}%
5148 %<latexrelease|fltrace>\def\@addtodblcol{%
5149 %<latexrelease|fltrace> \begingroup
5150 %<*trace>
5151 %<latexrelease|fltrace> \fl@trace{***Start addtodblcol}%
5152 %</trace>
5153 %<latexrelease|fltrace> \@insertfalse
5154 %<latexrelease|fltrace> \@setfloattypecounts
5155 %<latexrelease|fltrace> \@getfpsbit \tw@
5156 %<*trace>
5157 %<latexrelease|fltrace> \fl@trace{fpstype \ifodd \@tempcnta OK
5158 %<latexrelease|fltrace> \else not \fi dbltop: \the \@fpstype}%
5159 %</trace>
5160 %<latexrelease|fltrace> \ifodd\@tempcnta
5161 %<latexrelease|fltrace> \@flsetnum \@dbltopnum
5162 %<latexrelease|fltrace> \ifnum \@dbltopnum>\z@
5163 %<latexrelease|fltrace> \@tempswafalse
5164 %<latexrelease|fltrace> \ifdim \@dbltoproom>\ht\@currbox
5165 %<latexrelease|fltrace> \@tempswatrue
5166 %<*trace>
5167 %<latexrelease|fltrace> \fl@trace{Space OK: \@dbltoproom =
5168 %<latexrelease|fltrace> \the \@dbltoproom > \the \ht \@currbox
5169 %<latexrelease|fltrace> (dbltoproom)}%
5170 %</trace>
5171 %<latexrelease|fltrace> \else
5172 %<*trace>
5173 %<latexrelease|fltrace> \fl@trace{fpstype: \the \@fpstype (addtodblcol)}%
5174 %</trace>
5175 %<latexrelease|fltrace> \ifnum \@fpstype<\sixt@@n
5176 %<*trace>
5177 %<latexrelease|fltrace> \fl@trace{BANG float ignoring \@dbltoproom}%
5178 %<latexrelease|fltrace> \fl@trace{\@spaces \@dbltoproom =
5179 %<latexrelease|fltrace> \the \@dbltoproom.
5180 %<latexrelease|fltrace> Ht float: \the \ht \@currbox-BANG}%
5181 %</trace>
5182 % \end{macrocode}
5183 % Need to check that there is room on the page, using the local value
5184 % of |\@textmin| to make the necessary adjustment to |\@dbltoproom|.
5185 % \begin{macrocode}
5186 %<latexrelease|fltrace> \advance \@dbltoproom \@textmin
5187 %<*trace>
5188 %<latexrelease|fltrace> \fl@trace{Local value of texmin: \the\@textmin}%
5189 %<latexrelease|fltrace> \fl@trace{\@spaces space on page =
5190 %<latexrelease|fltrace> \the \@dbltoproom.
5191 %<latexrelease|fltrace> Ht float: \the \ht \@currbox-BANG}%
5192 %</trace>
5193 %<latexrelease|fltrace> \ifdim \@dbltoproom>\ht\@currbox
5194 %<latexrelease|fltrace> \@tempswatrue
5195 %<*trace>
5196 %<latexrelease|fltrace> \fl@trace{Space OK BANG: space on page =
5197 %<latexrelease|fltrace> \the\@dbltoproom > \the\ht\@currbox}%
5198 %<latexrelease|fltrace> \else
5199 %<latexrelease|fltrace> \fl@trace{fpstype: \the \@fpstype}%
5200 %<latexrelease|fltrace> \fl@trace{Fail---no room dbltoproom-BANG?:}%
5201 %<latexrelease|fltrace> \fl@trace{\@spaces space on page =
5202 %<latexrelease|fltrace> \the \@dbltoproom.
5203 %<latexrelease|fltrace> Ht float: \the \ht \@currbox}%
5204 %</trace>
5205 %<latexrelease|fltrace> \fi
5206 %<latexrelease|fltrace> \advance \@dbltoproom -\@textmin
5207 %<*trace>
5208 %<latexrelease|fltrace> \else
5209 %<latexrelease|fltrace> \fl@trace{fpstype: \the \@fpstype}%
5210 %<latexrelease|fltrace> \fl@trace{Fail---no room dbltoproom-ORD?:}%
5211 %<latexrelease|fltrace> \fl@trace{\@spaces \@dbltoproom =
5212 %<latexrelease|fltrace> \the \@dbltoproom.
5213 %<latexrelease|fltrace> Ht float: \the \ht \@currbox}%
5214 %</trace>
5215 %<latexrelease|fltrace> \fi
5216 %<latexrelease|fltrace> \fi
5217 %<latexrelease|fltrace> \if@tempswa
5218 %<latexrelease|fltrace> \@bitor \@currtype \@dbldeferlist
5219 %<*trace>
5220 %<latexrelease|fltrace> \fl@trace{dbldeferlist:
5221 %<latexrelease|fltrace> \@dbldeferlist: (before)}%
5222 %</trace>
5223 %<latexrelease|fltrace> \if@test
5224 %<*trace>
5225 %<latexrelease|fltrace> \fl@trace{type already on list: dbldefer}%
5226 %</trace>
5227 %<latexrelease|fltrace> \else
5228 %<latexrelease|fltrace> \@tempdima -\ht\@currbox
5229 %<latexrelease|fltrace> \advance\@tempdima
5230 %<latexrelease|fltrace> -\ifx \@dbltoplist\@empty
5231 %<latexrelease|fltrace> \dbltextfloatsep
5232 %<latexrelease|fltrace> \else \dblfloatsep \fi
5233 %<latexrelease|fltrace> \global \advance \@dbltoproom \@tempdima
5234 %<latexrelease|fltrace> \global \advance \@colht \@tempdima
5235 %<latexrelease|fltrace> \global \advance \@dbltopnum \m@ne
5236 %<latexrelease|fltrace> \@cons \@dbltoplist \@currbox
5237 %<*trace>
5238 %<latexrelease|fltrace> \fl@trace{dbltopnum (after) =
5239 %<latexrelease|fltrace> \the \@dbltopnum}%
5240 %<latexrelease|fltrace> \fl@trace{***Success: dbltop}%
5241 %</trace>
5242 %<latexrelease|fltrace> \@inserttrue
5243 %<latexrelease|fltrace> \fi
5244 %<latexrelease|fltrace> \fi
5245 %<*trace>
5246 %<latexrelease|fltrace> \else
5247 %<latexrelease|fltrace> \fl@trace{Fail: dbltopnum = \the \@dbltopnum:
5248 %<latexrelease|fltrace> fpstype \the \@fpstype=ORD?}%
5249 %<latexrelease|fltrace> \ifnum \@fpstype<\sixt@@n
5250 %<latexrelease|fltrace> \fl@trace{ERROR: !t float not successful
5251 %<latexrelease|fltrace> (addtodblcol)}%
5252 %<latexrelease|fltrace> \fi
5253 %</trace>
5254 %<latexrelease|fltrace> \fi
5255 %<latexrelease|fltrace> \fi
5256 %<latexrelease|fltrace> \if@insert
5257 %<latexrelease|fltrace> \else
5258 %<*trace>
5259 %<latexrelease|fltrace> \fl@trace{put on dbldeferlist}%
5260 %</trace>
5261 %<latexrelease|fltrace> \@cons\@dbldeferlist\@currbox
5262 %<*trace>
5263 %<latexrelease|fltrace> \fl@trace{dbldeferlist: \@dbldeferlist: (after)}%
5264 %</trace>
5265 %<latexrelease|fltrace> \fi
5266 %<*trace>
5267 %<latexrelease|fltrace> \fl@trace{End of addtodblcol -- locally count:}%
5268 %<latexrelease|fltrace> \fl@trace{ dbltop: \the \@dbltopnum.}%
5269 %</trace>
5270 %<latexrelease|fltrace> \endgroup
5271 %<*trace>
5272 %<latexrelease|fltrace> \fl@trace{End of addtodblcol -- globally count:}%
5273 %<latexrelease|fltrace> \fl@trace{dbltop: \the \@dbltopnum.}%
5274 %</trace>
5275 %<latexrelease|fltrace>}%
5276 %<latexrelease|fltrace>\EndIncludeInRelease
5277 % \end{macrocode}
5278 % \end{macro}
5279 %
5280 %
5281 %
5282 % \begin{macro}{\@addmarginpar}
5283 % \begin{macrocode}
5284 %<*2ekernel>
5285 \def\@addmarginpar{\@next\@marbox\@currlist{\@cons\@freelist\@marbox
5286 \@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne
5287 \if@twocolumn
5288 \if@firstcolumn \@tempcnta\m@ne \fi
5289 \else
5290 \if@mparswitch
5291 \ifodd\c@page \else\@tempcnta\m@ne \fi
5292 \fi
5293 \if@reversemargin \@tempcnta -\@tempcnta \fi
5294 \fi
5295 \ifnum\@tempcnta <\z@ \global\setbox\@marbox\box\@currbox \fi
5296 \@tempdima\@mparbottom
5297 \advance\@tempdima -\@pageht
5298 \advance\@tempdima\ht\@marbox
5299 \ifdim\@tempdima >\z@
5300 \@latex@warning@no@line {Marginpar on page \thepage\space moved}%
5301 \else
5302 \@tempdima\z@
5303 \fi
5304 \global\@mparbottom\@pageht
5305 \global\advance\@mparbottom\@tempdima
5306 \global\advance\@mparbottom\dp\@marbox
5307 \global\advance\@mparbottom\marginparpush
5308 \advance\@tempdima -\ht\@marbox
5309 % \end{macrocode}
5310 % Putting box movement inside the `marbox':
5311 % \begin{macrocode}
5312 \global\setbox \@marbox
5313 \vbox {\vskip \@tempdima
5314 \box \@marbox}%
5315 \global \ht\@marbox \z@
5316 \global \dp\@marbox \z@
5317 % \end{macrocode}
5318 % Sticking (rather than gluing:-) the `marbox' to the line above,
5319 % changed vskip to kern:
5320 % \begin{macrocode}
5321 \kern -\@pagedp
5322 \nointerlineskip
5323 \hb@xt@\columnwidth
5324 {\ifnum \@tempcnta >\z@
5325 \hskip\columnwidth \hskip\marginparsep
5326 \else
5327 \hskip -\marginparsep \hskip -\marginparwidth
5328 \fi
5329 \box\@marbox \hss}%
5330 % \end{macrocode}
5331 % For this reason the following code can vanish:
5332 %\begin{verbatim}
5333 % \nobreak %% No longer needed. CAR92/12
5334 % \vskip -\@tempdima %% No longer needed. CAR92/12
5335 %\end{verbatim}
5336 % \begin{macrocode}
5337 \nointerlineskip
5338 \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}}
5339 % \end{macrocode}
5340 % \end{macro}
5341 %
5342 % \subsubsection{Kludgeins}
5343 %
5344 % This part of the file is part of the implementation of the following
5345 % two new commands for \LaTeX2e{}.
5346 %
5347 %\begin{verbatim}
5348 % \enlargethispage{<dim>}
5349 %\end{verbatim}
5350 % Adds |<dim>| to the height of the current column only. On the printed
5351 % page the bottom of this column is extended downwards by exactly
5352 % |<dim>| without having any effect on the placement of the footer; this
5353 % may result in an overprinting.
5354 %
5355 %\begin{verbatim}
5356 % \enlargethispage*{<dim>}
5357 %\end{verbatim}
5358 %% Similar to |\enlargethispage| but it tries to squeeze the column to
5359 % be printed in as small a space as possible, ie it uses any
5360 % shrinkability in the column. If the column was not explicitly broken
5361 % (\eg with |\pagebreak|) this may result in an overfull box message but
5362 % except for this it will come out as expected (if you know what to
5363 % expect).
5364 %
5365 % The star form of this command is dedicated to Leslie Lamport, the
5366 % other we need for ourselves (FMi, CAR).
5367 %
5368 % These commands may well have unwanted effects if used soon
5369 % before a |\clearpage|: please give keep them clear of such places.
5370 %
5371 % \begin{macro}{\@kludgeins}
5372 % \changes{v0.1c}{1993/11/23}{Insert added}
5373 % The insert which makes \TeX{} do a lot of the necessary work.
5374 % All we need to put into it is the amount by which the pagegoal
5375 % should be changed.
5376 % \begin{macrocode}
5377 \newinsert \@kludgeins
5378 \global\dimen\@kludgeins \maxdimen
5379 \global\count\@kludgeins 1000
5380 % \end{macrocode}
5381 % \end{macro}
5382 %
5383 %
5384 % \begin{macro}{\enlargethispage}
5385 % \begin{macro}{\enlargethispage*}
5386 % \changes{v0.1c}{1993/11/23}{Commands added}
5387 % The user command.
5388 % \begin{macrocode}
5389 \gdef \enlargethispage {%
5390 \@ifstar
5391 {%
5392 %<*trace>
5393 \fl@trace{Enlarging page height * }%
5394 %</trace>
5395 \@enlargepage{\hbox{\kern\p@}}}%
5396 {%
5397 %<*trace>
5398 \fl@trace{Enlarging page height exactly---}%
5399 %</trace>
5400 \@enlargepage\@empty}%
5401 }
5402 % \end{macrocode}
5403 % \end{macro}
5404 % \end{macro}
5405 %
5406 %
5407 % \begin{macro}{\@enlargepage}
5408 % \changes{v0.1c}{1993/11/23}{Command added}
5409 % This actually inserts the insert, after checking for extreme
5410 % values of the change.
5411 % \begin{macrocode}
5412 \gdef\@enlargepage#1#2{%
5413 %<*trace>
5414 \fl@trace{\@spaces\@spaces by #2}%
5415 %</trace>
5416 \@tempskipa#2\relax
5417 \ifdim \@tempskipa>.5\maxdimen
5418 \@latex@error{Suggested\space extra\space height\space
5419 (\the\@tempskipa)\space dangerously\space
5420 large}\@eha
5421 \else
5422 \ifdim \vsize<.5\maxdimen
5423 %<*trace>
5424 \fl@trace {Kludgeins added--pagegoal before: \the\pagegoal}%
5425 %</trace>
5426 \@bsphack
5427 \insert\@kludgeins{#1\vskip-\@tempskipa}%
5428 \@esphack
5429 % \end{macrocode}
5430 % This next bit is for tracing only:
5431 % \begin{macrocode}
5432 %<*trace>
5433 \ifvmode \par
5434 \fl@trace {Kludgeins added--pagegoal after: \the \pagegoal}%
5435 \fi
5436 %</trace>
5437 \else
5438 \@latex@error{Page\space height\space already\space
5439 too\space large}\@eha
5440 \fi
5441 \fi
5442 }
5443 % \end{macrocode}
5444 % \end{macro}
5445 %
5446 %
5447 %
5448 %
5449 %
5450 % \begin{macro}{\ShowFloat}
5451 % This command provides some information about the contenta of a
5452 % float register. Float registers have internal names of the form
5453 % \cs{bx@}\meta{Uppercase-letter(s)-or numbers} and you specify just this
5454 % letter or letters as the argument, e.g., \verb=\ShowFloat{A}=.
5455 % (There is not much error recovery if you specify something that
5456 % isn't a float.)
5457 % \changes{v1.4g}{2021/07/31}{Macro added}
5458 % \changes{v1.4h}{2021/09/03}{Renamed, original name never distributed}
5459 % \begin{macrocode}
5460 %</2ekernel>
5461 %<*2ekernel|latexrelease>
5462 %<latexrelease>\IncludeInRelease{2021/11/15}%
5463 %<latexrelease> {\ShowFloat}{Show float register contents}%
5464 \def\ShowFloat#1{\begingroup
5465 \let \fl@trace \fl@tracemessage
5466 \fl@trace{***Float #1 details:}%
5467 \ifcsname bx@#1\endcsname
5468 \expandafter\fl@ShowFloat\csname bx@#1\endcsname
5469 \else
5470 \fl@trace{Not a float!}%
5471 \fi
5472 \endgroup
5473 }
5474 \def\fl@ShowFloat#1{%
5475 \fl@traceval{\count#1}% % this here should be interpreted on day
5476 \fl@traceval{\ht#1}%
5477 \fl@traceval{\dp#1}%
5478 \fl@traceval{\wd#1}%
5479 {\tracingonline1\showboxbreadth10\showboxdepth3\showbox#1}%
5480 }
5481 % \end{macrocode}
5482 % Here are two definitions from \texttt{fltrace} that make the above
5483 % code work:
5484 % \begin{macrocode}
5485 \def \fl@traceval #1{\fl@trace{\string #1 = \the #1}}
5486 \def \fl@tracemessage #1{{\let\@elt\@empty\typeout{LaTeX2e: #1}}}
5487 %</2ekernel|latexrelease>
5488 %<latexrelease>\EndIncludeInRelease
5489 % \end{macrocode}
5490 %
5491 % \begin{macrocode}
5492 %<latexrelease>\IncludeInRelease{0000/00/00}%
5493 %<latexrelease> {\ShowFloat}{Show float register contents}%
5494 %<latexrelease>
5495 %<latexrelease>\let\ShowFloat\@undefined
5496 %<latexrelease>\let\fl@ShowFloat\@undefined
5497 %<latexrelease>\let\fl@traceval\@undefined
5498 %<latexrelease>\let\fl@tracemessage\@undefined
5499 %<latexrelease>\EndIncludeInRelease
5500 % \end{macrocode}
5501 % \end{macro}
5502 %
5503 %
5504 %
5505 %
5506 % \subsubsection{Float control}
5507 %
5508 % This part implements controllable floats and other changes
5509 % to the float mechanism.
5510 %
5511 % It provides, at the document level, the following command for
5512 % inclusion in \LaTeX2e{}.
5513 %
5514 % \begin{verbatim}
5515 % \suppressfloats
5516 % \end{verbatim}
5517 %
5518 % This suppresses all further floats on the current page.
5519 %
5520 % With an optional argument it suppresses only floats only in certain
5521 % positions on the current page.
5522 % \begin{quote}
5523 % |[t]|\quad suppresses only floats at the top of the page
5524 % |[b]|\quad suppresses only floats at the bottom of the page
5525 % \end{quote}
5526 %
5527 % It also enables the use of an extra specifier, {\tt !}, in the
5528 % location optional argument of a float. If this is present then,
5529 % just for this particular float, whenever it is processed by the float
5530 % mechanism the following are ignored:
5531 %
5532 % \begin{itemize}
5533 % \item all restrictions on the number of floats which can appear;
5534 % \item all explicit restrictions on the amount of space which should
5535 % (not) be occupied by floats and/or text.
5536 % \end{itemize}
5537 %
5538 % The mechanism will still attempt to ensure that pages are not
5539 % overfull.
5540 %
5541 % These specifiers override, for the single float, the suppression
5542 % commands described above.
5543 %
5544 %
5545 % In its current form, it also supplies a reasonably exhaustive, and
5546 % somewhat baroque, means of tracing some aspects of the float
5547 % mechanism.
5548 %
5549 % More tracing.
5550 % \begin{macro}{\fl@trace}
5551 % \begin{macro}{\tracefloatsoff}
5552 % \begin{macro}{\tracefloats}
5553 % \begin{macro}{\fl@traceval}
5554 % \begin{macro}{\tracefloatvals}
5555 % \begin{macro}{\fl@tracemessage}
5556 % \changes{v1.0c}{1993/11/30}{Commands added}
5557 % \changes{v1.0h}{1993/12/12}{Commands changed}
5558 % \changes{v1.0j}{1993/12/17}{tracefloatvals made a document command}
5559 % Set-up tracing for floats independent of other tracing as it
5560 % produces mega-output. Default is no tracing.
5561 % \changes{v1.1j}{1995/04/24}
5562 % {Do not add to kernel unless `trace' specified}
5563 % \changes{v1.2n}{2014/04/24}
5564 % {Renamed internal trace commands; provide as package}
5565 %
5566 % \begin{macrocode}
5567 %<*fltrace>
5568 \def \fl@tracemessage #1{{\let\@elt\@empty\typeout{LaTeX2e: #1}}}
5569 \def \tracefloats{\let \fl@trace \fl@tracemessage}
5570 \def \tracefloatsoff {\let \fl@trace \@gobble}
5571 \tracefloatsoff
5572 \def \fl@traceval #1{\fl@trace{\string #1 = \the #1}}
5573 \IncludeInRelease{2015/01/01}{\tracefloatvals}%
5574 {trace float vals}%
5575 \def \tracefloatvals{%
5576 % \end{macrocode}
5577 % As |\@dblfloatplacement| sets |\f@depth| it needs to be run
5578 % inside a group, otherwise the float placement will test for the
5579 % wrong value.\footnote{This is a somewhat questionable design.}
5580 % \begin{macrocode}
5581 \begingroup
5582 % \end{macrocode}
5583 % When the user requests \cs{tracefloatvals} then they should show
5584 % regardless of the tracing state, so locally we make sure that it
5585 % is activated.
5586 % \changes{v1.4e}{2021/07/31}{Enable display when doing \cs{tracefloatvals}}
5587 % \begin{macrocode}
5588 \tracefloats
5589 % \end{macrocode}
5590 %
5591 % \begin{macrocode}
5592 \@dblfloatplacement
5593 \@floatplacement
5594 \fl@trace{***Float placement parameters:}%
5595 \fl@traceval\@colnum
5596 \fl@traceval\@colroom
5597 \fl@traceval\@topnum
5598 \fl@traceval\@toproom
5599 \fl@traceval\@botnum
5600 \fl@traceval\@botroom
5601 \fl@traceval\@fpmin
5602 \fl@trace{\string\textfraction = \textfraction}%
5603 \fl@traceval\@dbltopnum
5604 \fl@traceval\@dbltoproom
5605 \fl@trace{\string\textfraction = \textfraction}%
5606 \fl@trace{toplist: \@toplist}%
5607 \fl@trace{botlist: \@botlist}%
5608 \fl@trace{midlist: \@midlist}%
5609 \fl@trace{deferlist: \@deferlist}%
5610 \fl@trace{dbltoplist: \@dbltoplist}%
5611 %FMi \fl@trace{dbldeferlist: \@dbldeferlist}%
5612 \endgroup
5613 }
5614 \EndIncludeInRelease
5615 \IncludeInRelease{0000/00/00}{\tracefloatvals}%
5616 {trace float vals}%
5617 \def \tracefloatvals{%
5618 \begingroup
5619 \tracefloats
5620 \@dblfloatplacement
5621 \@floatplacement
5622 \fl@trace{***Float placement parameters:}%
5623 \fl@traceval\@colnum
5624 \fl@traceval\@colroom
5625 \fl@traceval\@topnum
5626 \fl@traceval\@toproom
5627 \fl@traceval\@botnum
5628 \fl@traceval\@botroom
5629 \fl@traceval\@fpmin
5630 \fl@trace{\string\textfraction = \textfraction}%
5631 \fl@traceval\@dbltopnum
5632 \fl@traceval\@dbltoproom
5633 \fl@trace{\string\textfraction = \textfraction}%
5634 \fl@trace{toplist: \@toplist}%
5635 \fl@trace{botlist: \@botlist}%
5636 \fl@trace{midlist: \@midlist}%
5637 \fl@trace{deferlist: \@deferlist}%
5638 \fl@trace{dbltoplist: \@dbltoplist}%
5639 % next line only in old releases
5640 \fl@trace{dbldeferlist: \@dbldeferlist}%
5641 \endgroup
5642 }
5643 \EndIncludeInRelease
5644 % \end{macrocode}
5645 %
5646 %
5647 %
5648 %
5649 % We need to make sure that \texttt{fltrace} comes before
5650 % \texttt{flafter} to make the tracing work.
5651 % \begin{macrocode}
5652 \@ifpackageloaded{flafter}
5653 {\PackageWarningNoLine
5654 {fltrace}{Load 'fltrace' before 'flafter'\MessageBreak
5655 Attempting to recover by reloading 'flafter'}%
5656 % \end{macrocode}
5657 % Hide the fact that \texttt{flafter} was already loaded and then
5658 % request it anew.
5659 % \changes{v1.2m}{2015/01/20}{Reset \cs{IncludeInRelease} flags}
5660 % \begin{macrocode}
5661 \expandafter\let\csname [email protected]\endcsname\relax
5662 \def\reserved@a#1{%
5663 \expandafter\let\csname\string#1+flafter+IIR\endcsname\relax}%
5664 \reserved@a\@addtocurcol
5665 \reserved@a\@addtonextcol
5666 \RequirePackage{flafter}}{}
5667 %</fltrace>
5668 % \end{macrocode}
5669 % As the code for \texttt{flafter} will contain tracing calls so
5670 % that it works in conjunction with \texttt{fltrace} we need to
5671 % provide a dummy definition for |\fl@trace| in that package.
5672 % \begin{macrocode}
5673 %<*flafter>
5674 \providecommand\fl@trace[1]{}
5675 %</flafter>
5676 % \end{macrocode}
5677 % \end{macro}
5678 % \end{macro}
5679 % \end{macro}
5680 % \end{macro}
5681 % \end{macro}
5682 % \end{macro}
5683 %
5684 % \begin{macro}{\suppressfloats}
5685 % \begin{macro}{\@flstop}
5686 % \changes{v1.0f}{1993/12/05}{Commands added}
5687 % Float suppression commands: these set the relevant counter
5688 % globally to zero. Thus they are overridden for a particular float
5689 % by an ! specifier.
5690 %
5691 % \begin{macrocode}
5692 %<*2ekernel>
5693 \def \suppressfloats {%
5694 \@ifnextchar [%
5695 \@flstop
5696 {\global \@colnum \z@}%
5697 }
5698 % \end{macrocode}
5699 % Maybe this should be a loop over |#1|?
5700 % \begin{macrocode}
5701 \def \@flstop [#1]{%
5702 \if t#1%
5703 \global \@topnum \z@
5704 \fi
5705 \if b#1%
5706 \global \@botnum \z@
5707 \fi
5708 }
5709 % \end{macrocode}
5710 % \end{macro}
5711 % \end{macro}
5712 %
5713 %
5714 % Manipulation of float placement and type; both their strings and the
5715 % corresponding count registers.
5716 %
5717 % \begin{macro}{\@fpstype}
5718 % \begin{macro}{\@reqcolroom}
5719 % \begin{macro}{\@textfloatsheight}
5720 % \changes{v1.0f}{1993/12/05}{Commands added}
5721 % First a new count register to go with |\@currtype|.
5722 %
5723 % Then a new skip register, for information needed to remove the
5724 % |\@maxsep| conservatism: it is possible that this could use a
5725 % temporary register.
5726 %
5727 % Finally a dimension register to hold the total height of in-text
5728 % floats on the current page. This is needed to implement a
5729 % major change in the functionality of |\@addtocurcol| which is,
5730 % nevertheless, a bug fix.
5731 % It is not local and therefore cannot be a temporary register.
5732 %
5733 % \begin{macrocode}
5734 \newcount \@fpstype
5735 \newdimen \@reqcolroom
5736 \newdimen \@textfloatsheight
5737 % \end{macrocode}
5738 % \end{macro}
5739 % \end{macro}
5740 % \end{macro}
5741 %
5742 %
5743 % \begin{macro}{\saved@reqcolroom}
5744 % Saved value of \cs{@reqcolroom}; this is needed when making several tests.
5745 % \begin{macrocode}
5746 %</2ekernel>
5747 %<*2ekernel|latexrelease>
5748 %<latexrelease>\IncludeInRelease{2025/06/01}%
5749 %<latexrelease> {\saved@reqcolroom}{float placement calculation}%
5750 \newdimen \saved@reqcolroom
5751 %</2ekernel|latexrelease>
5752 %<latexrelease>\EndIncludeInRelease
5753 %<latexrelease>\IncludeInRelease{0000/00/00}%
5754 %<latexrelease> {\saved@reqcolroom}{float placement calculation}%
5755 %<latexrelease>\let \saved@reqcolroom \@undefined
5756 %<latexrelease>\EndIncludeInRelease
5757 % \end{macrocode}
5758 % \end{macro}
5759 %
5760 % \begin{macro}{\@fpsadddefault}
5761 % \changes{v1.0f}{1993/12/05}{Command added}
5762 % Adds the default placement to what is already there.
5763 %
5764 % Should not need to change this, but could do it as follows:
5765 % \begin{verbatim}
5766 %\def \@fpsadddefault {%
5767 % \@temptokena \expandafter\expandafter\expandafter
5768 % {\csname fps@\@captype \endcsname}%
5769 % \edef \reserved@a {\the\@temptokena}%
5770 % \@onelevel@sanitize \reserved@a
5771 % \edef \@fps {\@fps\reserved@a}%
5772 %}
5773 % \end{verbatim}
5774 %
5775 % \begin{macrocode}
5776 %<*2ekernel|fltrace>
5777 \def \@fpsadddefault {%
5778 %<*trace>
5779 \fl@trace{fps changed from: \@fps}%
5780 %</trace>
5781 \edef \@fps {\@fps\csname fps@\@captype \endcsname}%
5782 \@latex@warning {%
5783 No positions in optional float specifier.\MessageBreak
5784 Default added (so using `\@fps')}%
5785 }
5786 % \end{macrocode}
5787 % \end{macro}
5788 %
5789 % \begin{macro}{\@setfloattypecounts}
5790 % \changes{v1.0f}{1993/12/05}{Command added}
5791 % Sets counters |\@fpstype| and |\@currtype|.
5792 %
5793 % BANG $==$ bit4 of $|\count\@currbox| = 0$.
5794 %
5795 % \begin{macrocode}
5796 \def \@setfloattypecounts {%
5797 \@currtype \count\@currbox
5798 \@fpstype \count\@currbox
5799 \divide\@currtype\@xxxii \multiply\@currtype\@xxxii
5800 \advance \@fpstype -\@currtype
5801 %<*trace>
5802 \fl@trace{(mod 32) fpstype: \the \@fpstype}%
5803 \fl@trace{(mult of 32) currtype: \the \@currtype}%
5804 % Tracing only: but some should be changed into real errors/warnings?
5805 \ifnum \@fpstype<\sixt@@n
5806 \ifnum \@fpstype=\z@
5807 \fl@trace{ERROR: no PLACEMENT, fpstype = \the \@fpstype = 0?}%
5808 \fi
5809 \ifnum \@fpstype=\@ne
5810 \fl@trace{WARNING: only h, fpstype = \the \@fpstype = 1?}%
5811 \fi
5812 \fl@trace{BANG float}%
5813 \else
5814 \ifnum \@fpstype=\sixt@@n
5815 \fl@trace{ERROR: no PLACEMENT, fpstype = \the \@fpstype = 16?}%
5816 \fi
5817 \ifnum \@fpstype=17
5818 \fl@trace{WARNING: only h, fpstype = \the \@fpstype = 17?}%
5819 \fi
5820 \fl@trace{ORD float}%
5821 \fi
5822 %</trace>
5823 }
5824 %</2ekernel|fltrace>
5825 % \end{macrocode}
5826 % \end{macro}
5827 %
5828 % Macros for getting, testing and setting bits of the fps.
5829 %
5830 %
5831 % \begin{macro}{\@getfpsbit}
5832 % \changes{v1.0f}{1993/12/05}{Command added}
5833 % Sets |\@tempcnta| to required bit of |\count\@currbox|.
5834 %
5835 % \begin{macrocode}
5836 %<*2ekernel>
5837 \def \@getfpsbit {%
5838 \@boxfpsbit \@currbox
5839 }
5840 % \end{macrocode}
5841 % \end{macro}
5842 %
5843 %
5844 % \begin{macro}{\@boxfpsbit}
5845 % \changes{v1.0f}{1993/12/05}{Command added}
5846 % Used above.
5847 % \begin{macrocode}
5848 \def \@boxfpsbit #1#2{%
5849 \@tempcnta \count#1%
5850 \divide \@tempcnta #2\relax
5851 }
5852 % \end{macrocode}
5853 % \end{macro}
5854 %
5855 % \begin{macro}{\@testfp}
5856 % \changes{v1.0f}{1993/12/05}{Command added}
5857 % New definition of the float page test.
5858 %
5859 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
5860 % \begin{macrocode}
5861 \def \@testfp #1{%
5862 \@boxfpsbit #18\relax % Really `#1 8' for human readers!
5863 \ifodd \@tempcnta
5864 \else
5865 \@testtrue
5866 \fi
5867 }
5868 % \end{macrocode}
5869 % \end{macro}
5870 %
5871 %
5872 % \begin{macro}{\@setfpsbit}
5873 % \changes{v1.0f}{1993/12/05}{Command added}
5874 % Sets required bit of |\@tempcnta| (to 1).
5875 %
5876 % \begin{macrocode}
5877 \def \@setfpsbit #1{%
5878 \@tempcntb \@tempcnta
5879 \divide \@tempcntb #1\relax
5880 \ifodd \@tempcntb
5881 \else
5882 \advance \@tempcnta #1\relax
5883 \fi
5884 }
5885 %</2ekernel>
5886 % \end{macrocode}
5887 % \end{macro}
5888 %
5889 %
5890 % \begin{macro}{\@resethfps}
5891 % \changes{v1.0f}{1993/12/05}{Command added}
5892 % \changes{v1.0h}{1993/12/12}{Warnings added: minimal}
5893 % \changes{v1.0m}{1994/04/24}{Warning changed}
5894 % \changes{v1.0m}{1994/04/24}{Number 2 changed to \cs{tw@}}
5895 % \changes{v1.0o}{1994/05/02}{Code shortened}
5896 % Globally adds t as a possible location for an h or !h only placement:
5897 % this must be done using the count.
5898 %
5899 % Although it will leave |\@fpstype| set to 17 even if it was
5900 % originally 1, this does not matter since it is the last thing in
5901 % |\@addtocurcol|.
5902 % \begin{macrocode}
5903 %<*2ekernel|fltrace>
5904 \def \@resethfps {%
5905 \let\reserved@a\@empty
5906 \ifnum \@fpstype=\@ne
5907 \def \reserved@a {!}%
5908 \@fpstype 17
5909 \fi
5910 \ifnum \@fpstype=17
5911 \global \advance \count\@currbox \tw@
5912 \@latex@warning@no@line {%
5913 `\reserved@a h' float specifier changed to `\reserved@a ht'}%
5914 %<*trace>
5915 \fl@trace{%
5916 `t' added to `\reserved@a h'- new Count: \the \count\@currbox}%
5917 %</trace>
5918 \fi
5919 }
5920 % \end{macrocode}
5921 % \end{macro}
5922 %
5923 %
5924 % Special stuff for BANG floats.
5925 %
5926 % \begin{macro}{\@flsetnum}
5927 % \changes{v1.0f}{1993/12/05}{Command added}
5928 %
5929 % Ignores any zero float counter value in case BANG.
5930 %
5931 % It uses a local assignment to the normally global counter: a bit
5932 % naughty, perhaps?
5933 %
5934 % These assignments are safe so long as the counter involved is only
5935 % consulted once (\ie only for the `bang float') with the changed value.
5936 % This is the case within |\@addtocurcol| because it is used only
5937 % once within a call of the output routine (which forms a group).
5938 %
5939 % For |\@addtonextcol| this is achieved by putting a group around its
5940 % code; this is needed because it is called (by |\@startcolumn|) for
5941 % each float which was on the deferlist. Almost identical
5942 % considerations pertain to |\@addtodblcol|. There may be more
5943 % efficient ways to handle this, but the group seems to be the simplest.
5944 %
5945 % \changes{v1.0n}{1994/04/30}{Rogue space removed}
5946 % \begin{macrocode}
5947 \def \@flsetnum #1{%
5948 %<*trace>
5949 \fl@trace{fpstype: \the \@fpstype (flsetnum \string#1)}%
5950 %</trace>
5951 \ifnum \@fpstype<\sixt@@n
5952 \ifnum #1=\z@
5953 %<*trace>
5954 \fl@trace{BANG float resetting \string#1 to 1}%
5955 %</trace>
5956 #1\@ne
5957 \fi
5958 \fi
5959 %<*trace>
5960 \fl@trace{#1 (before) = \the #1}%
5961 %</trace>
5962 }
5963 % \end{macrocode}
5964 % \end{macro}
5965 %
5966 %
5967 % \begin{macro}{\@flsettextmin}
5968 % \changes{v1.0f}{1993/12/05}{Command added}
5969 % This ignores |\textfraction| space restriction in case BANG.
5970 %
5971 % \begin{macrocode}
5972 \def \@flsettextmin {%
5973 %<*trace>
5974 \fl@trace{fpstype: \the \@fpstype (flsettextmin)}%
5975 %</trace>
5976 \ifnum \@fpstype<\sixt@@n
5977 %<*trace>
5978 \fl@trace{BANG ignoring textmin}%
5979 %</trace>
5980 \@textmin \z@
5981 \else
5982 \@textmin \textfraction\@colht
5983 %<*trace>
5984 \fl@trace{ORD textmin = \the \@textmin}%
5985 %</trace>
5986 \fi
5987 }
5988 % \end{macrocode}
5989 % \end{macro}
5990 %
5991 %
5992 % \begin{macro}{\@flcheckspace}
5993 % \changes{v1.0f}{1993/12/05}{Command added}
5994 % This ignores space restriction in case BANG; this is still slightly
5995 % conservative since it does not allow for the fact that, if there is
5996 % no text in the column then |\textfloatsep| is not needed.
5997 % Sets |@tempswa| true if there is room for |\@currbox|.
5998 %
5999 % \begin{macrocode}
6000 %</2ekernel|fltrace>
6001 %<*2ekernel|fltrace|latexrelease>
6002 %<latexrelease|fltrace>\IncludeInRelease{2025/06/01}%
6003 %<latexrelease|fltrace> {\@flcheckspace}{float placement calculation}%
6004 \def \@flcheckspace #1#2{%
6005 % \end{macrocode}
6006 % When this test is executed, the value of \cs{@reqcolroom} may
6007 % no longer be correct due to a previous test that altered it. We
6008 % therefore reset it to a value saved earlier.
6009 % \changes{v1.4n}{2025/01/29}{Reset current value of \cs{@reqcolroom} (gh/1645)}
6010 % \begin{macrocode}
6011 \@reqcolroom \saved@reqcolroom
6012 \advance \@reqcolroom
6013 \ifx #2\@empty \textfloatsep \else \floatsep \fi
6014 %<*trace>
6015 \fl@trace{colroom = \the \@colroom
6016 (flcheckspace \string#1 \string#2)}%
6017 \fl@trace{reqcolroom = \the \@reqcolroom
6018 (flcheckspace \string#1 \string#2)}%
6019 %</trace>
6020 \ifdim \@colroom>\@reqcolroom
6021 \ifdim #1>\ht\@currbox
6022 \@tempswatrue
6023 %<*trace>
6024 \fl@trace{Space OK: #1 = \the #1 > \the \ht \@currbox
6025 (flcheckspace \string#1 \string#2)}%
6026 %</trace>
6027 \else
6028 %<*trace>
6029 \fl@trace{fpstype: \the \@fpstype
6030 (flcheckspace \string#1 \string#2)}%
6031 %</trace>
6032 \ifnum \@fpstype<\sixt@@n
6033 %<*trace>
6034 \fl@trace{BANG float ignoring #1
6035 (flcheckspace \string#1 \string#2):}%
6036 \fl@trace{\@spaces #1 = \the #1. Ht float: \the \ht \@currbox
6037 \space BANG}%
6038 %</trace>
6039 \@tempswatrue
6040 %<*trace>
6041 \else
6042 \fl@trace{Fail---no room (flcheckspace \string#1 \string#2)
6043 (fpstype \the \@fpstype=ORD?):}%
6044 \fl@trace{\@spaces #1 = \the #1. Ht float: \the \ht \@currbox
6045 \space ORD?}%
6046 %</trace>
6047 \fi
6048 \fi
6049 %<*trace>
6050 \else
6051 \fl@trace{Fail---no room at 2nd test of colroom
6052 (flcheckspace \string#1 \string#2)}%
6053 %</trace>
6054 \fi
6055 }
6056 %</2ekernel|fltrace|latexrelease>
6057 % \end{macrocode}
6058 %
6059 % \begin{macrocode}
6060 %<latexrelease|fltrace>\EndIncludeInRelease
6061 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
6062 %<latexrelease|fltrace> {\@flcheckspace}{float placement calculation}%
6063 %<latexrelease|fltrace>
6064 %<latexrelease|fltrace>\def \@flcheckspace #1#2{%
6065 %<latexrelease|fltrace> \advance \@reqcolroom
6066 %<latexrelease|fltrace> \ifx #2\@empty \textfloatsep \else \floatsep \fi
6067 %<*trace>
6068 %<latexrelease|fltrace> \fl@trace{colroom = \the \@colroom
6069 %<latexrelease|fltrace> (flcheckspace \string#1 \string#2)}%
6070 %<latexrelease|fltrace> \fl@trace{reqcolroom = \the \@reqcolroom
6071 %<latexrelease|fltrace> (flcheckspace \string#1 \string#2)}%
6072 %</trace>
6073 %<latexrelease|fltrace> \ifdim \@colroom>\@reqcolroom
6074 %<latexrelease|fltrace> \ifdim #1>\ht\@currbox
6075 %<latexrelease|fltrace> \@tempswatrue
6076 %<*trace>
6077 %<latexrelease|fltrace> \fl@trace{Space OK: #1 = \the #1 > \the \ht \@currbox
6078 %<latexrelease|fltrace> (flcheckspace \string#1 \string#2)}%
6079 %</trace>
6080 %<latexrelease|fltrace> \else
6081 %<*trace>
6082 %<latexrelease|fltrace> \fl@trace{fpstype: \the \@fpstype
6083 %<latexrelease|fltrace> (flcheckspace \string#1 \string#2)}%
6084 %</trace>
6085 %<latexrelease|fltrace> \ifnum \@fpstype<\sixt@@n
6086 %<*trace>
6087 %<latexrelease|fltrace> \fl@trace{BANG float ignoring #1
6088 %<latexrelease|fltrace> (flcheckspace \string#1 \string#2):}%
6089 %<latexrelease|fltrace> \fl@trace{\@spaces #1 = \the #1. Ht float: \the \ht \@currbox
6090 %<latexrelease|fltrace> \space BANG}%
6091 %</trace>
6092 %<latexrelease|fltrace> \@tempswatrue
6093 %<*trace>
6094 %<latexrelease|fltrace> \else
6095 %<latexrelease|fltrace> \fl@trace{Fail---no room (flcheckspace \string#1 \string#2)
6096 %<latexrelease|fltrace> (fpstype \the \@fpstype=ORD?):}%
6097 %<latexrelease|fltrace> \fl@trace{\@spaces #1 = \the #1. Ht float: \the \ht \@currbox
6098 %<latexrelease|fltrace> \space ORD?}%
6099 %</trace>
6100 %<latexrelease|fltrace> \fi
6101 %<latexrelease|fltrace> \fi
6102 %<*trace>
6103 %<latexrelease|fltrace> \else
6104 %<latexrelease|fltrace> \fl@trace{Fail---no room at 2nd test of colroom
6105 %<latexrelease|fltrace> (flcheckspace \string#1 \string#2)}%
6106 %</trace>
6107 %<latexrelease|fltrace> \fi
6108 %<latexrelease|fltrace>}
6109 %<latexrelease|fltrace>\EndIncludeInRelease
6110 % \end{macrocode}
6111 % \end{macro}
6112 %
6113 %
6114 % \begin{macro}{\@flupdates}
6115 % \changes{v1.0f}{1993/12/05}{Command added}
6116 % This updates everything when a float is placed.
6117 %
6118 % \begin{macrocode}
6119 %<*2ekernel>
6120 \def \@flupdates #1#2#3{%
6121 \global \advance #1\m@ne
6122 \global \advance \@colnum \m@ne
6123 \@tempdima -\ht\@currbox
6124 \advance \@tempdima
6125 -\ifx #3\@empty \textfloatsep \else \floatsep \fi
6126 \global \advance #2\@tempdima
6127 \global \advance \@colroom \@tempdima
6128 \@cons #3\@currbox
6129 }
6130 %</2ekernel>
6131 % \end{macrocode}
6132 % \end{macro}
6133 %
6134 %
6135 % Interesting facts about float mechanisms past and present, together
6136 % with a summary of various features, some unresolved:
6137 %
6138 % \begin{enumerate}
6139 % \item The value |\textfraction| does not affect the processing
6140 % of doublecol floats: this seems sensible, but should be
6141 % documented.
6142 % \item |\twocolumn| floatplacement was wrong: dbl not needed, ord
6143 % needed.
6144 % \item |\@floatplacement| was not called after |\@startdblcol|
6145 % or |\@topnewpage|. This has been changed; it is clearly a bug
6146 % fix.
6147 % \item The use |\@topnewpage| when |\dblfigrule| is non-trivial
6148 % produced a rule in the wrong place. This has been fixed by not
6149 % using |\dblfigrule| when processing the `float' from
6150 % |\@topnewpage|.
6151 % \item If the specifier was just h and the float could not be put
6152 % here, it went on the deferlist and stayed there until a clearpage.
6153 % It now gets changed to a `th': this is only an error-recovery
6154 % action, putting just h or !h should be deprecated.
6155 % \item |\@dblmaxsep| was `the maximum of |\dblfloatsep| and
6156 % |\dbltexfloatsep|'. But it was never used! Now gone completely,
6157 % like |\@maxsep|.
6158 % \item After an h float is put on a page, it was counted as text when
6159 % applying the |\textfraction| test; this is possibly too big a
6160 % change although it is a bug fix?
6161 % \item Two consecutive h floats are separated by twice |\intextsep|:
6162 % this could be changed to one by use of |\addvspace|, OK?
6163 % Note that it would also mean that less space is put in if an h
6164 % float immediately follows other spaces. This is also possibly
6165 % too big a change, at least for compatibility mode?
6166 % Or it may be simply wrong! It has not been changed.
6167 % \item Now |\@addtocurcol| checks first for just p fps. I think
6168 % that this is an increase in efficiency, but maybe the coding
6169 % should be made even more efficient.
6170 % \item |\@tryfcolumn| now tests if the list is empty first, otherwise
6171 % lots of wasted time! Thus this test has been removed from
6172 % |\@startcolumn|.
6173 % As Frank pointed out, this makes |\@startcolumn| less
6174 % efficient. But it is now the same as |\@startdblcolumn|: I can
6175 % see no reason why they should be different, but which is best?
6176 % \item Why is |\@colroom| set in |\@doclearpage|?
6177 % \item Footnotes. Check what |\clearpage| does when footnotes are
6178 % left over. Footnotes are not put on float pages and, also,
6179 % |\@addtonextcol| ignores the existence of held-over footnotes
6180 % in deciding what floats can go on the page. Not changed.
6181 % \item |\clearpage| can still lose non-boxes, at least when floats
6182 % are involved. It also moves some to the `wrong page', but this
6183 % may be a coding problem.
6184 % \item The ! option makes it necessary to check in |\output| that
6185 % there is enough room left on the page after adding a float. (This
6186 % would have been necessary anyway if anyone set |\@textmin| too
6187 % close to zero! A similar danger existed also if the text in a
6188 % |\twocolumn[text]| entity gets too large.)
6189 % The current implementation of this also makes the normal case a
6190 % little less efficient, OK?
6191 % Not enough room means, at present, less than |\baselineskip|,
6192 % with a warning: is this OK? Should it be made generic (another
6193 % parameter)?
6194 % \item There are four possibilities for supporting this:
6195 %
6196 % |\twocolumn[\maketitle more text]|
6197 %
6198 % One is to change
6199 % |\maketitle| slightly to allow this. Another is to change
6200 % |\@topnewpage| so that more than one |\twocolumn[]| command is
6201 % allowed; in this case |\maketitle\twocolumn[more text]| will work.
6202 % The former is more robust from the user's viewpoint, but makes the
6203 % code for |\maketitle| rather ad hoc (maybe it is already?).
6204 % Another is to misuse the global twocolumn flag locally within
6205 % |\@topnewpage|.
6206 % Yet another is to move the column count register from the multicol
6207 % package into the kernel. This has been done.
6208 % \item Where should the reinserts be put to maximise the
6209 % probability that footnotes come out on the correct page?
6210 % Or should we go for as much compatibility as possible (but see
6211 % next item)?
6212 % \item Should we continue to support (as much as possible)
6213 % |\samepage|? Some of its intended functionality is now advertised
6214 % as being provided by |\enlargethispage|. Use of either is likely
6215 % to result in wrongly placed footnotes, marginals, etc.
6216 % Which should have priority: obeying the pagination instructions,
6217 % or correct placement of notes/marginalia?
6218 % \item Is the adjustment of space to cause shrinking in the
6219 % kludge-* case correct? Should it be limited to 0pt?
6220 % \item Is the setting of |\boxmaxdepth| in makecol and friends
6221 % needed? It only has any effect if |\@textbottom| ends with a box
6222 % or rule, in which case the vskip to allow for its depth should
6223 % also be added. If it is kept, it should probably be the last
6224 % thing in the box. It has now been removed.
6225 %
6226 % It would perhaps be better to document that |\@textbottom|
6227 % and |\@texttop| must have natural height 0pt.
6228 % \item I cannot see why the vskip adjustment for the depth
6229 % is needed if boxmaxdepth is used to ensure that there is never
6230 % a too deep box.
6231 % \item The value of |\boxmaxdepth| should be explicitly set
6232 % whenever necessary: it is too risky to assume that it has any
6233 % particular value. Care is needed in deciding what to set it to.
6234 %
6235 % It is interesting to note that the value of |\boxmaxdepth| is
6236 % unique in being read before the local settings for the box group
6237 % are reset; all other parameter settings which affect the box
6238 % construction use their values outside the box group.
6239 % \item Should |\@maxdepth| store the setting of |\maxdepth| from
6240 % lplain? Or should we provide a proper interface to class files
6241 % for setting these?
6242 % \end{enumerate}
6243 %
6244 % An analysis of various other macros.
6245 %
6246 % |\@opcol| should do |\@floatplacement|, but where? Right at the
6247 % end, since it always occurs at the start of a column.
6248 % \begin{verbatim}
6249 % \def\@opcol{%
6250 % % Why is this done first?
6251 % \global \@mparbottom \z@
6252 % \if@twocolumn
6253 % \@outputdblcol
6254 % \else
6255 % \@outputpage
6256 % % This is not needed since it is done at the end of
6257 % % |\@outputpage|:
6258 % \global \@colht \textheight
6259 % \fi}
6260 % \end{verbatim}
6261 %
6262 % Only tracing has been added to these.
6263 %
6264 % \begin{macrocode}
6265 %<latexrelease|fltrace>\IncludeInRelease{2017/01/01}%
6266 %<latexrelease|fltrace> {\@makefcolumn}{negative height floats}%
6267 %<*2ekernel|fltrace|latexrelease>
6268 \def\@makefcolumn #1{%
6269 \begingroup
6270 % \end{macrocode}
6271 % \changes{v1.3b}{2017/01/01}{make fpmin negative so ignored even if float height is negative}
6272 % \begin{macrocode}
6273 \@fpmin -\maxdimen
6274 % \end{macrocode}
6275 %
6276 % \begin{macrocode}
6277 \let \@testfp \@gobble
6278 \@tryfcolumn #1%
6279 \endgroup
6280 %<*trace>
6281 \if@fcolmade
6282 \fl@trace{PAGE: in \string\clearpage
6283 \if@twocolumn ---twocolumn\fi---}%
6284 \fl@trace{----- float column/page completed from \string#1}%
6285 \fi
6286 %</trace>
6287 }
6288 % \end{macrocode}
6289 %
6290 % \begin{macrocode}
6291 %<latexrelease|fltrace>\EndIncludeInRelease
6292 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
6293 %<latexrelease|fltrace> {\@makefcolumn}{negative height floats}%
6294 %<latexrelease|fltrace>\def\@makefcolumn #1{%
6295 %<latexrelease|fltrace> \begingroup
6296 %<latexrelease|fltrace> \@fpmin \z@
6297 %<latexrelease|fltrace> \let \@testfp \@gobble
6298 %<latexrelease|fltrace> \@tryfcolumn #1%
6299 %<latexrelease|fltrace> \endgroup
6300 %<*trace>
6301 %<latexrelease|fltrace> \if@fcolmade
6302 %<latexrelease|fltrace> \fl@trace{PAGE: in \string\clearpage
6303 %<latexrelease|fltrace> \if@twocolumn ---twocolumn\fi---}%
6304 %<latexrelease|fltrace> \fl@trace{----- float column/page completed
6305 %<latexrelease|fltrace> from \string#1}%
6306 %<latexrelease|fltrace> \fi
6307 %</trace>
6308 %<latexrelease|fltrace>}
6309 %<latexrelease|fltrace>\EndIncludeInRelease
6310 %</2ekernel|fltrace|latexrelease>
6311 % \end{macrocode}
6312 % This will line up the last baselines in the two
6313 % columns provided they are constructed in the normal way: \ie ending
6314 % in a skip of minus the original depth, with |\@textbottom| adding
6315 % nothing.
6316 %
6317 % Thus again it is essential for |\@textbottom| to have depth 0pt.
6318 % \changes{1.2g}{2000/07/12}{Ensure that rule is in \cs{normalcolor}}
6319 % \changes{v1.2m}{2014/12/30}{Command updated (latexrelease)}
6320 % \begin{macrocode}
6321 %<latexrelease|fltrace>\IncludeInRelease{2025/06/01}%
6322 %<latexrelease|fltrace> {\@outputdblcol}{Use new mark mechanism}%
6323 %<*2ekernel|fltrace|latexrelease>
6324 % \end{macrocode}
6325 %
6326 % \begin{macrocode}
6327 \def\@outputdblcol{%
6328 \if@firstcolumn
6329 \global\@firstcolumnfalse
6330 % \end{macrocode}
6331 % Save the left column
6332 % \begin{macrocode}
6333 \global\setbox\@leftcolumn\copy\@outputbox
6334 %<fltrace> \fl@trace{PAGE: first column boxed}%
6335 % \end{macrocode}
6336 %
6337 % \begin{macrocode}
6338 \else
6339 \global\@firstcolumntrue
6340 \setbox\@outputbox\vbox{%
6341 \hb@xt@\textwidth{%
6342 \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
6343 \hfil
6344 % \end{macrocode}
6345 % \changes{v1.1m}{2006/09/13}{Ensure that rule is in \cs{normalcolor}}
6346 % The color of the \cs{vrule} should be \cs{normalcolor} as to not
6347 % inherit the color from the column.
6348 % \begin{macrocode}
6349 {\normalcolor\vrule \@width\columnseprule}%
6350 \hfil
6351 \hb@xt@\columnwidth{\box\@outputbox \hss}}}%
6352 %<fltrace> \fl@trace{PAGE: second column also boxed}%
6353 \@combinedblfloats
6354 \@outputpage
6355 %<fltrace> \fl@trace{PAGE: two column page completed}%
6356 \begingroup
6357 \@dblfloatplacement
6358 \@startdblcolumn
6359 \@whilesw\if@fcolmade \fi{\@outputpage
6360 %<fltrace> \fl@trace{PAGE: double float page completed}%
6361 \@startdblcolumn}%
6362 \endgroup
6363 \fi}%
6364 % \end{macrocode}
6365 %
6366 % \begin{macrocode}
6367 %<latexrelease|fltrace>\EndIncludeInRelease
6368 %<latexrelease|fltrace>\IncludeInRelease{2015/01/01}%
6369 %<latexrelease|fltrace> {\@outputdblcol}{2 column marks}%
6370 %<latexrelease|fltrace>\def\@outputdblcol{%
6371 %<latexrelease|fltrace> \if@firstcolumn
6372 %<latexrelease|fltrace> \global\@firstcolumnfalse
6373 %<latexrelease|fltrace> \global\setbox\@leftcolumn\copy\@outputbox
6374 %<latexrelease|fltrace> \splitmaxdepth\maxdimen
6375 %<latexrelease|fltrace> \vbadness\maxdimen
6376 %<latexrelease|fltrace> \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
6377 %<latexrelease|fltrace> \setbox\@outputbox\vsplit\@outputbox to\maxdimen
6378 %<latexrelease|fltrace> \toks@\expandafter{\topmark}%
6379 %<latexrelease|fltrace> \xdef\@firstcoltopmark{\the\toks@}%
6380 %<latexrelease|fltrace> \toks@\expandafter{\splitfirstmark}%
6381 %<latexrelease|fltrace> \xdef\@firstcolfirstmark{\the\toks@}%
6382 %<latexrelease|fltrace> \ifx\@firstcolfirstmark\@empty
6383 %<latexrelease|fltrace> \global\let\@setmarks\relax
6384 %<latexrelease|fltrace> \else
6385 %<latexrelease|fltrace> \gdef\@setmarks{%
6386 %<latexrelease|fltrace> \let\firstmark\@firstcolfirstmark
6387 %<latexrelease|fltrace> \let\topmark\@firstcoltopmark}%
6388 %<latexrelease|fltrace> \fi
6389 %<latexrelease|fltrace> \else
6390 %<latexrelease|fltrace> \global\@firstcolumntrue
6391 %<latexrelease|fltrace> \setbox\@outputbox\vbox{%
6392 %<latexrelease|fltrace> \hb@xt@\textwidth{%
6393 %<latexrelease|fltrace> \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
6394 %<latexrelease|fltrace> \hfil
6395 %<latexrelease|fltrace> {\normalcolor\vrule \@width\columnseprule}%
6396 %<latexrelease|fltrace> \hfil
6397 %<latexrelease|fltrace> \hb@xt@\columnwidth{\box\@outputbox \hss}}}%
6398 %<latexrelease|fltrace> \@combinedblfloats
6399 %<latexrelease|fltrace> \@setmarks
6400 %<latexrelease|fltrace> \@outputpage
6401 %<latexrelease|fltrace> \begingroup
6402 %<latexrelease|fltrace> \@dblfloatplacement
6403 %<latexrelease|fltrace> \@startdblcolumn
6404 %<latexrelease|fltrace> \@whilesw\if@fcolmade \fi{\@outputpage
6405 %<latexrelease|fltrace> \@startdblcolumn}%
6406 %<latexrelease|fltrace> \endgroup
6407 %<latexrelease|fltrace> \fi}
6408 %<latexrelease|fltrace>\EndIncludeInRelease
6409 % \end{macrocode}
6410 %
6411 % \begin{macrocode}
6412 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
6413 %<latexrelease|fltrace> {\@outputdblcol}{2 column marks}%
6414 %<latexrelease|fltrace>\def\@outputdblcol{%
6415 %<latexrelease|fltrace> \if@firstcolumn
6416 %<latexrelease|fltrace> \global \@firstcolumnfalse
6417 %<latexrelease|fltrace> \global \setbox\@leftcolumn \box\@outputbox
6418 %<*trace>
6419 %<latexrelease|fltrace> \fl@trace{PAGE: first column boxed}%
6420 %</trace>
6421 %<latexrelease|fltrace> \else
6422 %<latexrelease|fltrace> \global \@firstcolumntrue
6423 %<latexrelease|fltrace> \setbox\@outputbox \vbox {%
6424 %<latexrelease|fltrace> \hb@xt@\textwidth {%
6425 %<latexrelease|fltrace> \hb@xt@\columnwidth {%
6426 %<latexrelease|fltrace> \box\@leftcolumn \hss}%
6427 %<latexrelease|fltrace> \hfil
6428 %<latexrelease|fltrace> {\normalcolor\vrule
6429 %<latexrelease|fltrace> \@width\columnseprule}%
6430 %<latexrelease|fltrace> \hfil
6431 %<latexrelease|fltrace> \hb@xt@\columnwidth {%
6432 %<latexrelease|fltrace> \box\@outputbox \hss}%
6433 %<latexrelease|fltrace> }%
6434 %<latexrelease|fltrace> }%
6435 %<*trace>
6436 %<latexrelease|fltrace> \fl@trace{PAGE: second column also boxed}%
6437 %</trace>
6438 %<latexrelease|fltrace> \@combinedblfloats
6439 %<latexrelease|fltrace> \@outputpage
6440 %<*trace>
6441 %<latexrelease|fltrace> \fl@trace{PAGE: two column page completed}%
6442 %</trace>
6443 %<latexrelease|fltrace> \begingroup
6444 %<latexrelease|fltrace> \@dblfloatplacement
6445 %<latexrelease|fltrace> \@startdblcolumn
6446 % \end{macrocode}
6447 % This loop could be replaced by an |\expandafter| tail
6448 % recursion in\\ |\@startdblcolumn|.
6449 % \begin{macrocode}
6450 %<latexrelease|fltrace> \@whilesw\if@fcolmade \fi
6451 %<latexrelease|fltrace> {\@outputpage
6452 %<*trace>
6453 %<latexrelease|fltrace> \fl@trace{PAGE: double float page completed}%
6454 %</trace>
6455 %<latexrelease|fltrace> \@startdblcolumn}%
6456 %<latexrelease|fltrace> \endgroup
6457 %<latexrelease|fltrace> \fi
6458 %<latexrelease|fltrace>}%
6459 %<latexrelease|fltrace>\EndIncludeInRelease
6460 %</2ekernel|fltrace|latexrelease>
6461 % \end{macrocode}
6462 %
6463 % \subsubsection{Float placement parameters}
6464 % \changes{v1.0i}{1993/12/14}{Section added to declare all parameters}
6465 %
6466 % The main purpose of this section is to ensure that all the
6467 % float-placement parameters which need to be set in a class file or
6468 % package have been declared. It also describes their use and sets
6469 % values for them which are reasonable for typical documents using
6470 % US letter or A4 sized paper.
6471 %
6472 % \paragraph{Limits for the placement of floating objects}
6473 %
6474 % \begin{macro}{\c@topnumber}
6475 % This counter holds the maximum number of
6476 % floats that can appear at the top of a text page or column.
6477 % \begin{macrocode}
6478 %<*2ekernel>
6479 \newcount\c@topnumber
6480 \setcounter{topnumber}{2}
6481 % \end{macrocode}
6482 % \end{macro}
6483 %
6484 % \begin{macro}{\topfraction}
6485 % This macro holds the maximum proportion (as a decimal number) of
6486 % a text page or column that can be occupied by floats at the top.
6487 % \begin{macrocode}
6488 \newcommand\topfraction{.7}
6489 % \end{macrocode}
6490 % \end{macro}
6491 %
6492 % \begin{macro}{\c@bottomnumber}
6493 % This counter holds the maximum number of
6494 % floats that can appear at the bottom of a text page or column.
6495 % \begin{macrocode}
6496 \newcount\c@bottomnumber
6497 \setcounter{bottomnumber}{1}
6498 % \end{macrocode}
6499 % \end{macro}
6500 %
6501 % \begin{macro}{\bottomfraction}
6502 % This macro holds the maximum proportion (as a decimal number) of
6503 % a text page or column that can be occupied by floats at the bottom.
6504 % \begin{macrocode}
6505 \newcommand\bottomfraction{.3}
6506 % \end{macrocode}
6507 % \end{macro}
6508 %
6509 % \begin{macro}{\c@totalnumber}
6510 % This counter holds the maximum number of floats that can appear on
6511 % any text page or column.
6512 % \begin{macrocode}
6513 \newcount\c@totalnumber
6514 \setcounter{totalnumber}{3}
6515 % \end{macrocode}
6516 % \end{macro}
6517 %
6518 % \begin{macro}{\textfraction}
6519 % This macro holds the minimum proportion (as a decimal number) of
6520 % a text page or column that must be occupied by text.
6521 % \begin{macrocode}
6522 \newcommand\textfraction{.2}
6523 % \end{macrocode}
6524 % \end{macro}
6525 %
6526 % \begin{macro}{\floatpagefraction}
6527 % This macro holds the minimum proportion (as a decimal number) of
6528 % a page or column that must be occupied by floating objects before a
6529 % `float page' is produced.
6530 % \begin{macrocode}
6531 \newcommand\floatpagefraction{.5}
6532 % \end{macrocode}
6533 % \end{macro}
6534 %
6535 % \begin{macro}{\c@dbltopnumber}
6536 % This counter holds the maximum number of double-column floats that
6537 % can appear on the top of a two-column text page.
6538 % \begin{macrocode}
6539 \newcount\c@dbltopnumber
6540 \setcounter{dbltopnumber}{2}
6541 % \end{macrocode}
6542 % \end{macro}
6543 %
6544 % \begin{macro}{\dbltopfraction}
6545 % This macro holds the maximum proportion (as a decimal number) of
6546 % a two-column text page that can be occupied by double-column floats
6547 % at the top.
6548 % \begin{macrocode}
6549 \newcommand\dbltopfraction{.7}
6550 % \end{macrocode}
6551 % \end{macro}
6552 %
6553 % \begin{macro}{\dblfloatpagefraction}
6554 % This macro holds the minimum proportion (as a decimal number) of
6555 % a page that must be occupied by double-column floating objects
6556 % before a `double-column float page' is produced.
6557 % \begin{macrocode}
6558 \newcommand\dblfloatpagefraction{.5}
6559 % \end{macrocode}
6560 % \end{macro}
6561 %
6562 % \paragraph{Floats on a text page}
6563 %
6564 % \begin{macro}{\floatsep}
6565 % \begin{macro}{\textfloatsep}
6566 % \begin{macro}{\intextsep}
6567 % When a floating object is placed on a page with text, these
6568 % parameters control the separation between the float and the other
6569 % objects on the page. These parameters are used for both
6570 % one-column mode and single-column floats in two-column mode.
6571 % They are all rubber lengths.
6572 %
6573 % |\floatsep| is the space between adjacent floats that are placed
6574 % at the top or bottom of the text page or column.
6575 %
6576 % |\textfloatsep| is the space between the main text and floats
6577 % at the top or bottom of the page or column.
6578 %
6579 % |\intextsep| is the space between in-text floats and the text.
6580 % \begin{macrocode}
6581 \newskip\floatsep
6582 \newskip\textfloatsep
6583 \newskip\intextsep
6584 \setlength\floatsep {12\p@ \@plus 2\p@ \@minus 2\p@}
6585 \setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
6586 \setlength\intextsep {12\p@ \@plus 2\p@ \@minus 2\p@}
6587 % \end{macrocode}
6588 % \end{macro}
6589 % \end{macro}
6590 % \end{macro}
6591 %
6592 % \begin{macro}{\dblfloatsep}
6593 % \begin{macro}{\dbltextfloatsep}
6594 % When double-column floats (floating objects that span the whole
6595 % |\textwidth|) are placed at the top of a text page in two-column
6596 % mode, the separation between the float and the text is controlled
6597 % by |\dblfloatsep| and |\dbltextfloatsep|. They are rubber lengths.
6598 %
6599 % |\dblfloatsep| is the space between adjacent double-column floats
6600 % placed at the top of the text page.
6601 %
6602 % |\dbltextfloatsep| is the space between the main text and
6603 % double-column floats at the top of the page.
6604 % \begin{macrocode}
6605 \newskip\dblfloatsep
6606 \newskip\dbltextfloatsep
6607 \setlength\dblfloatsep {12\p@ \@plus 2\p@ \@minus 2\p@}
6608 \setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
6609 % \end{macrocode}
6610 % \end{macro}
6611 % \end{macro}
6612 %
6613 % \paragraph{Floats on their own page or column}
6614 %
6615 % \begin{macro}{\@fptop}
6616 % \begin{macro}{\@fpsep}
6617 % \begin{macro}{\@fpbot}
6618 % When floating objects are placed on a separate page or column,
6619 % called a `float page', the layout of the page is controlled by
6620 % these parameters, which are rubber lengths.
6621 %
6622 % At the top of the page |\@fptop| is inserted;
6623 % typically this supplies some stretchable whitespace.
6624 % At the bottom of the page |\@fpbot| is inserted.
6625 % Between adjacent floats |\@fpsep| is inserted.
6626 %
6627 % These parameters are used for all floating objects on a
6628 % `float page' in one-column mode, and for single-column
6629 % floats in two-column mode.
6630 %
6631 % Note that at least one of the two parameters |\@fptop| and
6632 % |\@fpbot| should contain a |plus ...fil| so as to fill the
6633 % remaining empty space.
6634 % \begin{macrocode}
6635 \newskip\@fptop
6636 \newskip\@fpsep
6637 \newskip\@fpbot
6638 \setlength\@fptop{0\p@ \@plus 1fil}
6639 \setlength\@fpsep{8\p@ \@plus 2fil}
6640 \setlength\@fpbot{0\p@ \@plus 1fil}
6641 % \end{macrocode}
6642 % \end{macro}
6643 % \end{macro}
6644 % \end{macro}
6645 %
6646 % \begin{macro}{\@dblfptop}
6647 % \begin{macro}{\@dblfpsep}
6648 % \begin{macro}{\@dblfpbot}
6649 % Double-column `float pages' in two-column mode use similar
6650 % parameters.
6651 % \begin{macrocode}
6652 \newskip\@dblfptop
6653 \newskip\@dblfpsep
6654 \newskip\@dblfpbot
6655 \setlength\@dblfptop{0\p@ \@plus 1fil}
6656 \setlength\@dblfpsep{8\p@ \@plus 2fil}
6657 \setlength\@dblfpbot{0\p@ \@plus 1fil}
6658 % \end{macrocode}
6659 % \end{macro}
6660 % \end{macro}
6661 % \end{macro}
6662 %
6663 % \begin{macro}{\topfigrule}
6664 % \begin{macro}{\botfigrule}
6665 % \begin{macro}{\dblfigrule}
6666 % The macros can be used to put in rules between floats and text;
6667 % whatever they insert should be vertical mode material which takes
6668 % up zero space.
6669 % \task{CAR}{Add more rules (for Frank in addtocurcol)}
6670 % \begin{macrocode}
6671 \let\topfigrule=\relax
6672 \let\botfigrule=\relax
6673 \let\dblfigrule=\relax
6674 %</2ekernel>
6675 % \end{macrocode}
6676 % \end{macro}
6677 % \end{macro}
6678 % \end{macro}
6679 %
6680 %
6681 % \Finale
6682 \endinput