version using \language to suppress hyphenation in verb(atim)
[latex2e.git] / trunk / base / ltoutput.dtx
blobdf2d7233e23780d49960a77aca37745dc7b23d53
1 % \iffalse meta-comment
3 % Copyright 1993-2016
4 % The LaTeX3 Project and any individual authors listed elsewhere
5 % in this file.
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
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 %    http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
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.
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.
28 % \fi
29 % \iffalse
30 %%% From File: ltoutput.dtx
31 %<flafter>\ProvidesPackage{flafter}
32 %<fltrace>\ProvidesPackage{fltrace}
33 %<flafter,fltrace>       [2016/10/04 v1.3b
34 %<flafter>                  Standard LaTeX floats after reference (FMi)]
35 %<fltrace>                  Tracing LaTeX floats algorithm (FMi)]
37 %<*driver>
38 % \fi
39 \ProvidesFile{ltoutput.dtx}
40              [2016/10/04 v1.3b 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
50  \DocInput{\filename}
51 \end{document}
52 %</driver>
53 % \fi
57 % \iffalse
58 % LATEX VERSION 2e
59 % Copyright (C) 1992 by Leslie Lamport
60 % Copyright (C) 1994-2000 by Leslie Lamport, LaTeX3 project
62 % LaTeX 2e kernel file for the output routine.
64 % Part of this file is the latest (not greatest, it still
65 % deserves its name) version of kludge.sty.
67 % It also contains a few enhancements and many changes (corrections
68 % and tidyings) to the float mechanism and other parts of the output
69 % routine.
71 % The tracing in the file at present is mainly to help in testing the
72 % code but it may well be developed into a full float tracing
73 % package one day.
75 % ============================
76 % \fi
78 % \changes{v1.1p}{1995/08/25}{Support autoloading feature (FMi).}
79 % \task{CAR}{Update documentation.}
80 % \changes{v1.0k}{1994/02/08}{Documentation and tasks tidied.}
81 % \changes{v1.0l}{1994/03/15}{Driver added and further tidying.}
82 % \changes{v1.0l}{1994/03/15}{Some boxmaxdepth settings removed.}
83 % \changes{v1.0l}{1994/03/15}{Added some warnings when page gets full of
84 % top floats.}
85 % \changes{v1.0l}{1994/03/15}{Removed duplicated code and corrected
86 % docstrip options.}
87 % \changes{v1.0m}{1994/04/24}{Removed some long lines and other
88 % aesthetic changes.}
89 % \changes{v1.0m}{1994/04/24}{Corrected unverbed commands in
90 % documentation.}
91 % \changes{v1.0m}{1994/04/24}{Changed \cs{@normalsize} to
92 % \cs{normalsize}.}
93 % \changes{v1.0m}{1994/04/24}{Warning messages changed/corrected.}
94 % \changes{v1.0n}{1994/04/30}{Added \cs{col@number}.}
95 % \changes{v1.0n}{1994/04/30}{Fixed bug from \cs{dblfigrule} with
96 % \cs{@topnewpage}.}
97 % \changes{v1.0n}{1994/04/30}{Documentation tidied.}
98 % \changes{v1.0n}{1994/04/30}{\cs{@activechar@warning} changed to an
99 % info message.}
100 % \changes{v1.0n}{1994/04/30}{Full of floats action improved.}
101 % \changes{v1.0n}{1994/04/30}{Empty column action added.}
102 % \changes{v1.0o}{1994/05/02}{Code of \cs{@resethfps} shortened.}
103 % \changes{v1.0p}{1994/05/12}{\cs{normalcolor}added in various
104 % places (DPC).}
105 % \changes{v1.0q}{1994/05/16}{Changed setting of accents (FMi).}
106 % \changes{v1.0s}{1994/05/20}{Added setting of \cs{protect}
107 % during \cs{shipout}.}
108 % \changes{v1.0t}{1994/05/22}{Changed warnings and infos to
109 % new commands.}
110 % \changes{v1.0u}{1994/05/23}{Added \cs{MessageBreak}.}
111 % \changes{v1.0u}{1994/05/23}{Changed resetting of \cs{protect} after
112 % shipout.}
113 % \changes{v1.0v}{1994/05/25}{Extra documentation.}
114 % \changes{v1.0w}{1994/06/01}{Tidied up typesetting.}
116 % \changes{v1.1f}{1994/11/14}{Removed old definition of \cs{@testfp}.}
117 % \changes{v1.1h}{1994/11/17}
118 %         {\cs{@tempa} to \cs{reserved@a}.}
119 % \changes{v1.1m}{1995/05/07}{Use \cs{hb@xt@}.}
120 % \changes{v1.2n}{2015/02/21}
121 %         {Removed autoload code}
123 % \StopEventually{}
125 % \def \ie {i.e.~}
126 % \def \eg {e.g.~}
128 % \section{Output Routine}
130 % \subsection{Floats}
132 % The `2ekernel' code ensures that a |\usepackage{autoout1}| is
133 % essentially ignored if a `full' format is being used that has
134 % the autoload file mode already in the format.
135 %    \begin{macrocode}
136 %<defx>\begingroup
137 %<defx>\makeatletter
138 %<defx>\nfss@catcodes
139 %<2ekernel>\expandafter\let\csname ver@autoout1.sty\endcsname\fmtversion
140 %    \end{macrocode}
143 % \begin{oldcomments}
144 %    \begin{macrocode}
145 %<*2ekernel>
146 \message{output,}
147 %    \end{macrocode}
148 %     ****************************************
149 %     *               OUTPUT                 *
150 %     ****************************************
153 %  PAGE LAYOUT PARAMETERS
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.
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.
191 %   Page layout must initialize \@colht and \@colroom to \textheight.
193 %  PAGE STYLE PARAMETERS:
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.
222 %  FOOTNOTES: As in PLAIN, footnotes use \insert\footins.
224 %  PAGE LAYOUT SWITCHES AND MACROS
226 %   @twocolumn      : Boolean.  T if two columns per page globally.
228 %  PAGE STYLE MACROS AND SWITCHES
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.
254 %  FLOAT PLACEMENT PARAMETERS
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.
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
294 %  OUTPUT ROUTINE VARIABLES
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.
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.
306 %  \@textfloatsheight : The total height of in-text floats on the
307 %                       current page.
309 %  \footins : Footnote insertion number.
311 %  \@maxdepth : Saved value of TeX's \maxdepth.  Must be set
312 %               when any routine sets \maxdepth.
314 %            CALLING THE OUTPUT ROUTINE
315 %            --------------------------
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.
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.
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.
342 %             THE OUTPUT ROUTINE
343 %             ------------------
345 % FUNCTIONS USED IN THE OUTPUT ROUTINE:
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.
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!
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.
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.
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.
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.
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.
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.
418 %              If @twocolumn = true, then:
419 %                  If @firstcolumn = true, then it puts box \@outputbox
420 %                  into \@leftcolumn and sets @firstcolumn :=G false.
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.
428 %            USER COMMANDS THAT CALL OR AFFECT THE OUTPUT ROUTINE
429 %            ----------------------------------------------------
431 % \newpage == BEGIN \par\vfil\penalty -10000 END
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
439 % \cleardoublepage == BEGIN \clearpage
440 %                           if @twoside = true and c@page is even
441 %                             then \hbox{} \newpage fi
442 %                     END
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.
452 %            FLOAT-HANDLING MECHANISMS
453 %            -------------------------
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.
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.
482 %  A negative float specifier is used to indicate a marginal note.
484 %     MACROS AND DATA STRUCTURES FOR PROCESSING FLOATS
485 %     ------------------------------------------------
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.
497 %  The following macros are used for manipulating float lists.
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
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.
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.
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
533 % \@cons\LIST\NUM : Globally sets \LIST := \LIST * \@elt \NUM
535 % \@cons\LIST\NUM ==
536 %   BEGIN {  \@elt == \relax
537 %            \LIST :=G \LIST \@elt \NUM
538 %         }
540 %  BOX LISTS FOR FLOAT-PLACEMENT ALGORITHMS
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.
552 %  FLOAT-PLACEMENT ALGORITHMS
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
569 %  \@addtotoporbot : Tries to put insert \@currbox on \@toplist or
570 %                    \@botlist.
571 %                    Called only under same conditions as \@addtobot.
572 %                    If it succeeds, then:
573 %                       * sets @insert true
574 %                       * decrements \@toproom or \@botroom by \ht BOX
575 %                       * decrements \@colnum and either \@topnum or
576 %                         \@botnum by 1
577 %                       * decrements \@colroom by \ht BOX + \floatsep
578 %                         or \textfloatsep, as appropriate.
580 % \@addtocurcol : Tries to add \@currbox to current column, setting
581 %                 @insert true if it succeeds, false otherwise.
582 %                 It will add \@currbox to top only if bit 0 of
583 %                 \count \@currbox is 0, and to the bottom only if
584 %                 bit 0 = 0 or an earlier float of the same type is
585 %                 put on the bottom.
586 %                 If the float is put in the text, then
587 %                 \penalty\interlinepenalty is put
588 %                 right after the float, before the following \vskip,
589 %                 and \outputpenalty :=L 0.
591 % \@addtonextcol : Tries to add \@currbox to the next column, setting
592 %                  @insert true if it succeeds, false otherwise.
594 % \@addtodblcol : Tries to add \@currbox to the next double-column page,
595 %                 adding it to \@dbltoplist if it succeeds and
596 %                 \@dbldeferlist if it fails.
599 %  \@addmarginpar ==
600 %   BEGIN
601 %     if \@currlist nonempty
602 %       then remove \@marbox from \@currlist
603 %            add \@marbox and \@currbox to \@freelist
604 %                 %% NOTE: \@currbox = left box
605 %       else LaTeX error: ?  %% shouldn't happen
606 %     fi
607 %     \@tempcnta := 1     %% 1 = right, -1 = left
608 %     if @twocolumn = true
609 %       then if @firstcolumn = true
610 %              then \@tempcnta := -1
611 %            fi
612 %       else if @mparswitch = true
613 %              then if count0 odd
614 %                     else \@tempcnta := -1
615 %                   fi
616 %            fi
617 %            if @reversemargin = true
618 %               then \@tempcnta := -\@tempcnta
619 %            fi
620 %     fi
621 %     if \@tempcnta < 0 then \box\@marbox :=G \box\@currbox
622 %     fi
623 %     \@tempdima   :=L maximum(\@mparbottom - \@pageht
624 %                                           + ht of \@marbox, 0)
625 %     if \@tempdima > 0 then LaTeX warning: 'marginpar moved' fi
626 %     \@mparbottom :=G \@pageht + \@tempdima + depth of \@marbox
627 %                          + \marginparpush
628 %     \@tempdima   :=L \@tempdima - ht of \@marbox
629 %     \box\@marbox :=G \box\@currbox
630 %                                \vbox { \vskip \@tempdima
631 %                                        \box\@marbox
632 %                                       }
633 %     height of \@marbox :=G depth of \@marbox :=G 0
634 %     \kern -\@pagedp
635 %     \nointerlineskip
636 %     \hbox{ if @tempcnta > 0 then \hskip \columnwidth
637 %                                 \hskip \marginparsep
638 %                            else \hskip -\marginparsep
639 %                                 \hskip -\marginparwidth
640 %            fi
641 %            \box\@marbox \hss
642 %          }
643 %     \nobreak
644 %     \nointerlineskip
645 %     \hbox{\vrule height 0 width 0 depth \@pagedp}
646 %   END
648 %   Floats and marginpars add a lot of dead cycles.
649 %    \begin{macrocode}
650 \maxdeadcycles = 100
651 %    \end{macrocode}
653 %    \begin{macrocode}
654 \let\@elt\relax
655 %    \end{macrocode}
657 %    \begin{macrocode}
658 \def\@next#1#2#3#4{\ifx#2\@empty #4\else
659    \expandafter\@xnext #2\@@#1#2#3\fi}
660 %    \end{macrocode}
662 %    \begin{macrocode}
663 \def\@xnext \@elt #1#2\@@#3#4{\def#3{#1}\gdef#4{#2}}
664 %    \end{macrocode}
666 % \changes{v1.1v}{1996/07/26}{put \cs{global} into definition}
667 %    \begin{macrocode}
668 \def\@testfalse{\global\let\if@test\iffalse}
669 \def\@testtrue {\global\let\if@test\iftrue}
670 \@testfalse
671 %    \end{macrocode}
673 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
674 %    \begin{macrocode}
675 \def\@bitor#1#2{\@testfalse {\let\@elt\@xbitor
676    \@tempcnta #1\relax #2}}
677 %    \end{macrocode}
678 %    RmS 91/11/22: Added test for |\count#1 = 0|.
679 %                  Suggested by Chris Rowley.
682 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
683 %    \begin{macrocode}
684 \def\@xbitor #1{\@tempcntb \count#1
685    \ifnum \@tempcnta =\z@
686    \else
687      \divide\@tempcntb\@tempcnta
688      \ifodd\@tempcntb \@testtrue\fi
689    \fi}
690 %    \end{macrocode}
692 % DEFINITION OF FLOAT BOXES:
693 % \changes{v1.3a}{2015/09/205}
694 %         {extended \cs{@freelist}}
695 %    \begin{macrocode}
696 %</2ekernel>
697 %<latexrelease>\IncludeInRelease{2015/10/01}%
698 %<latexrelease>                 {\bx@ZZ}{Extended float list}%
699 %<*2ekernel|latexrelease>
700 \let\@elt\newinsert
701 %<*2ekernel>
702 \def\@freelist{%
703   \@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
704   \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
705   \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
706   \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R}
707 \@freelist
708 %</2ekernel>
709 \ifx\numexpr\@undefined\else
710 \def\reserved@a{%
711   \@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
712   \@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
713   \@elt\bx@AA\@elt\bx@BB\@elt\bx@CC\@elt\bx@DD\@elt\bx@EE
714   \@elt\bx@FF\@elt\bx@GG\@elt\bx@HH\@elt\bx@II\@elt\bx@JJ
715   \@elt\bx@KK\@elt\bx@LL\@elt\bx@MM\@elt\bx@NN
716   \@elt\bx@OO\@elt\bx@PP\@elt\bx@QQ\@elt\bx@RR
717   \@elt\bx@SS\@elt\bx@TT\@elt\bx@UU\@elt\bx@VV
718   \@elt\bx@WW\@elt\bx@XX\@elt\bx@YY\@elt\bx@ZZ}
719 \reserved@a
720 \def\@elt{\noexpand\@elt\noexpand}
721 \edef\@freelist{\@freelist\reserved@a}
723 \let\reserved@a\relax
724 \let\@elt\relax
725 %</2ekernel|latexrelease>
726 %<latexrelease>\EndIncludeInRelease
727 %<latexrelease>\IncludeInRelease{0000/00/00}%
728 %<latexrelease>                 {\bx@ZZ}{Extended float list}%
729 %<latexrelease>\def\@freelist{%
730 %<latexrelease>  \@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
731 %<latexrelease>  \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
732 %<latexrelease>  \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
733 %<latexrelease>  \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R}
734 %<latexrelease>  \insc@unt=234
735 %<latexrelease>\EndIncludeInRelease
736 %<*2ekernel>
737 %    \end{macrocode}
739 %    \begin{macrocode}
740 \gdef\@toplist{}
741 \gdef\@botlist{}
742 \gdef\@midlist{}
743 \gdef\@currlist{}
744 \gdef\@deferlist{}
745 \gdef\@dbltoplist{}
746 %    \begin{macrocode}
747 % \changes{v1.2m}{2015/03/12}
748 %         {initialise \cs{@dbldeferlist} again}
749 %    The new algorithm stores page wide floats together with column floats
750 %    in a single |\@deferlist| list. We keep |\@dbldeferlist| 
751 %    initialised  as empty so that packages that are testing for
752 %    deferred floats can use the same code for old or new float
753 %    handling. 
754 %    \end{macrocode}
755 \gdef\@dbldeferlist{}
756 %    \end{macrocode}
758 % PAGE LAYOUT PARAMETERS
759 %    \begin{macrocode}
760 \newdimen\topmargin
761 \newdimen\oddsidemargin
762 \newdimen\evensidemargin
763 \let\@themargin=\oddsidemargin
764 \newdimen\headheight
765 \newdimen\headsep
766 \newdimen\footskip
767 \newdimen\textheight
768 \newdimen\textwidth
769 \newdimen\columnwidth
770 \newdimen\columnsep
771 \newdimen\columnseprule
772 \newdimen\marginparwidth
773 \newdimen\marginparsep
774 \newdimen\marginparpush
775 %    \end{macrocode}
776 % \end{oldcomments}
778 % \begin{macro}{\AtBeginDvi}
779 % \changes{v1.1c}{1994/11/05}
780 %         {Added macro}
781 % \begin{macro}{\@begindvibox}
782 % \changes{v1.1c}{1994/11/05}
783 %         {Added macro}
784 % \changes{v1.1f}{1994/11/14}{Use normal box register: why a box?}
785 % \changes{v1.1l}{1995/04/24}{Add \cs{vbox} latex/1392}
787 %    We use a box register in which to put
788 %    stuff that must appear before anything else in the
789 %    |.dvi| file.
791 %    The stuff in the box should not add any typeset material to the
792 %    page when it is unboxed.
793 %    \begin{macrocode}
794 \newbox\@begindvibox
795 \def \AtBeginDvi #1{%
796   \global \setbox \@begindvibox
797     \vbox{\unvbox \@begindvibox #1}%
799 %    \end{macrocode}
800 % \end{macro}
801 % \end{macro}
803 %  \begin{macro}{\@maxdepth}
804 %    This is not the right place to set this; it needs to be set in a
805 %    class/style file when |\maxdepth| is set.
807 %    Also, many settings to |\maxdepth| should be to |\@maxdepth|,
808 %    probably?
809 % \task{All}{Sort out maxdepth: both should be set in the class files.}
810 %    \begin{macrocode}
811 \newdimen\@maxdepth
812 \@maxdepth = \maxdepth
813 %    \end{macrocode}
814 %  \end{macro}
815 % \begin{macro}{\paperheight}
816 % \changes{v0.1a}{1993/11/23}{Register added}
817 % \begin{macro}{\paperwidth}
818 % \changes{v0.1a}{1993/11/23}{Register added}
819 %    New |\paper|\ldots\ registers.
820 %    \begin{macrocode}
821 \newdimen\paperheight
822 \newdimen\paperwidth
823 %    \end{macrocode}
824 % \end{macro}
825 % \end{macro}
827 % \begin{macro}{\if@insert}
828 % \begin{macro}{\if@fcolmade}
829 % \begin{macro}{\if@specialpage}
830 % \begin{macro}{\if@firstcolumn}
831 % \begin{macro}{\if@twocolumn}
832 % \begin{macro}{\if@twoside}
833 % \begin{macro}{\if@reversemarginpar}
834 % \begin{macro}{\if@mparswitch}
835 % \begin{macro}{\col@number}
836 % \changes{v1.0n}{1994/04/30}{Added \cs{col@number}}
837 %    Local switches first:
838 %    \begin{macrocode}
839 \newif \if@insert
840 %    \end{macrocode}
841 %    These should definitely be global:
842 %    \begin{macrocode}
843 \newif \if@fcolmade
844 \newif \if@specialpage \@specialpagefalse
845 %    \end{macrocode}
846 %    These should be global but are not always set globally in other
847 %    files.
848 %    \begin{macrocode}
849 \newif \if@firstcolumn \@firstcolumntrue
850 \newif \if@twocolumn   \@twocolumnfalse
851 %    \end{macrocode}
852 %    Not sure about these: two questions.
853 %    Should things which must apply to a whole document be local or
854 %    global (they probably should be `preamble only' commands)?
855 %    Are these three such things?
856 %    \begin{macrocode}
857 \newif \if@twoside     \@twosidefalse
858 \newif \if@reversemargin \@reversemarginfalse
859 \newif \if@mparswitch  \@mparswitchfalse
860 %    \end{macrocode}
861 %    This counter has been imported from `multicol'.
862 %    \begin{macrocode}
863 \newcount \col@number
864 \col@number \@ne
865 %    \end{macrocode}
866 % \end{macro}
867 % \end{macro}
868 % \end{macro}
869 % \end{macro}
870 % \end{macro}
871 % \end{macro}
872 % \end{macro}
873 % \end{macro}
874 % \end{macro}
876 % \begin{oldcomments}
877 % INTERNAL REGISTERS
879 %    \begin{macrocode}
880 \newcount\@topnum
881 \newdimen\@toproom
882 \newcount\@dbltopnum
883 \newdimen\@dbltoproom
884 \newcount\@botnum
885 \newdimen\@botroom
886 \newcount\@colnum
887 \newdimen\@textmin
888 \newdimen\@fpmin
889 \newdimen\@colht
890 \newdimen\@colroom
891 \newdimen\@pageht
892 \newdimen\@pagedp
893 \newdimen\@mparbottom \@mparbottom\z@
894 \newcount\@currtype
895 \newbox\@outputbox
896 \newbox\@leftcolumn
897 \newbox\@holdpg
898 %    \end{macrocode}
900 %    \begin{macrocode}
901 \def\@thehead{\@oddhead} % initialization
902 \def\@thefoot{\@oddfoot}
903 %    \end{macrocode}
904 % \end{oldcomments}
906 %  \begin{macro}{\clearpage}
907 % \changes{v1.1r}{1995/10/11}{Added a check so that it does not lose
908 % the argument of \cs{twocolumn[...]}}
910 % The tests at the beginning are an experimental attempt to avoid a
911 % completely empty page after a |\twocolumn[...]|.  This prevents the
912 % text from the argument vanishing into a float box, never to be seen
913 % again.  We hope that it does not produce wrong formatting in other
914 % cases.
915 % \changes{v1.1v}{1996/07/26}{add number of missing percents}
916 %    \begin{macrocode}
917 \def\clearpage{%
918   \ifvmode
919     \ifnum \@dbltopnum =\m@ne
920       \ifdim \pagetotal <\topskip
921         \hbox{}%
922       \fi
923     \fi
924   \fi
925   \newpage
926   \write\m@ne{}%
927   \vbox{}%
928   \penalty -\@Mi
930 %    \end{macrocode}
931 % \end{macro}
933 %  \begin{macro}{\cleardoublepage}
935 %    \begin{macrocode}
936 \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
937     \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
938 %</2ekernel>
939 %    \end{macrocode}
940 % \end{macro}
942 %  \begin{macro}{\onecolumn}
943 % \changes{v1.0n}{1994/04/30}{Added setting of \cs{col@number}}
944 %    \begin{macrocode}
945 %<*2ekernel|fltrace>
946 \def\onecolumn{%
947   \clearpage
948   \global\columnwidth\textwidth
949   \global\hsize\columnwidth
950   \global\linewidth\columnwidth
951   \global\@twocolumnfalse
952   \col@number \@ne
953   \@floatplacement}
954 %    \end{macrocode}
955 % \end{macro}
957 %  \begin{macro}{\newpage}
958 % \changes{v1.1x}{1996/09/29}{Checks for noskipsec and inlabel added}
959 % \changes{v1.1x}{1996/09/29}{Checks for noskipsec and inlabel added}
960 % \changes{v1.1y}{1996/09/30}{Checks for noskipsec and inlabel removed
961 %                 pending further tests}
962 % \changes{v1.1z}{1996/10/24}{Better checks for noskipsec and
963 %                 inlabel added, plus nobreak}
964 % \changes{v1.2a}{1996/10/25}{Reset all flags explicitly}
965 %    The two checks at the beginning ensure that an item label or
966 %    run-in section title immediately before a |\newpage| get printed
967 %    on the correct page, the one before the page break.
969 %    All three tests are largely to make error processing more robust;
970 %    that is why they all reset the flags explicitly, even when it
971 %    would appear that this would be done by a |\leavevmode|.
972 %    \begin{macrocode}
973 \def \newpage {%
974   \if@noskipsec
975     \ifx \@nodocument\relax
976       \leavevmode
977       \global \@noskipsecfalse
978     \fi
979   \fi
980   \if@inlabel
981     \leavevmode
982     \global \@inlabelfalse
983   \fi
984   \if@nobreak \@nobreakfalse \everypar{}\fi
985   \par
986   \vfil
987   \penalty -\@M}
988 %    \end{macrocode}
989 %  \end{macro}
991 %  \begin{macro}{\@emptycol}
992 % \changes{v1.0n}{1994/04/30}{Empty column action added:
993 %                 \cs{@emptycol}}
994 %    It may be better to use an invisible rule rather than an empty
995 %    box here.
996 %    \begin{macrocode}
997 \def \@emptycol {\vbox{}\penalty -\@M}
998 %    \end{macrocode}
999 %  \end{macro}
1001 %  \begin{macro}{\twocolumn}
1002 %  \begin{macro}{\@topnewpage}
1003 % \changes{v1.0f}{1993/12/05}{Commands changed}
1004 % \changes{v1.0g}{1993/12/06}{\cs{@floatplacement} placement bug
1005 % fixed}
1006 % \changes{v1.0j}{1993/12/17}{check for vsize too small added}
1007 % \changes{v1.2c}{1997/11/09}{Documentation of vsize check enhanced}
1008 %    There are several bug fixes to the two-column stuff here.
1010 % \changes{v1.0n}{1994/04/30}{Added setting of \cs{col@number}}
1011 %    \begin{macrocode}
1012 \def \twocolumn {%
1013   \clearpage
1014   \global\columnwidth\textwidth
1015   \global\advance\columnwidth-\columnsep
1016   \global\divide\columnwidth\tw@
1017   \global\hsize\columnwidth
1018   \global\linewidth\columnwidth
1019   \global\@twocolumntrue
1020   \global\@firstcolumntrue
1021   \col@number \tw@
1022 %    \end{macrocode}
1023 %    There is no reason to put a |\@dblfloatplacement| here since
1024 %    |\@topnewpage| ignores these settings.
1025 %    The |\@floatplacement| is needed in case this comes after some
1026 %    changes.
1027 % \changes{v1.0h}{1993/12/12}{braces removed}
1028 %    \begin{macrocode}
1029   \@ifnextchar [\@topnewpage\@floatplacement
1031 %    \end{macrocode}
1033 %    Note that here, getting a box from the freelist can assume
1034 %    success since this comes just after a |\clearpage|.
1035 % \changes{v1.0n}{1994/04/30}{Added setting of \cs{col@number}}
1036 % \changes{v1.1a}{1994/10/31}
1037 %     {(DPC/CAR) Use \cs{color@begingroup} for colour}
1038 % \changes{v1.1a}{1994/10/31}
1039 %     {(DPC/CAR) Use \cs{normalcolor}}
1040 % \changes{v1.1a}{1994/10/31}
1041 %     {(DPC/CAR) Extra box added to remove colour resetting from vmode}
1042 % \changes{v1.1b}{1994/11/05}
1043 %         {Use new \cs{color@hbox} concept.}
1044 % \changes{v1.1i}{1994/11/21}{Changed to \cs{color@vbox}}
1045 % \changes{v1.1z}{1996/10/24}{Added \cs{@nodocument} to trap
1046 %                  \cs{twocolumn} in the preamble}
1047 %    \begin{macrocode}
1048 \long\def \@topnewpage [#1]{%
1049   \@nodocument
1050   \@next\@currbox\@freelist{}{}%
1051   \global \setbox\@currbox
1052     \color@vbox
1053       \normalcolor
1054       \vbox {%
1055         \hsize\textwidth
1056         \@parboxrestore
1057         \col@number \@ne
1058         #1%
1059         \vskip -\dbltextfloatsep
1060              }%
1061     \color@endbox
1062 %    \end{macrocode}
1063 %    Added size test and warning message; perhaps we should use
1064 %    an error message.
1065 % \changes{v1.0l}{1994/03/15}{Corrected and amended warning message}
1066 % \changes{v1.0m}{1994/04/24}{Warning message removed as it will be
1067 % generated later}
1068 %    \begin{macrocode}
1069   \ifdim \ht\@currbox>\textheight
1070     \ht\@currbox \textheight
1071   \fi
1072 %    \end{macrocode}
1073 %    This next line is not essential but it is more robust to make this
1074 %    value non-zero, in case of weird errors.
1076 %    This next bit is what is needed from |\@addtodblcol|, plus some
1077 %    extra checks for error trapping.
1078 %    \begin{macrocode}
1079   \global \count\@currbox \tw@
1080   \@tempdima -\ht\@currbox
1081   \advance \@tempdima -\dbltextfloatsep
1082   \global \advance \@colht \@tempdima
1083   \ifx \@dbltoplist \@empty
1084   \else
1085     \@latexerr{Float(s) lost}\@ehb
1086     \let \@dbltoplist \@empty
1087   \fi
1088   \@cons \@dbltoplist \@currbox
1089 %    \end{macrocode}
1090 %    This setting of |\@dbltopnum| is used only to change the
1091 %    typesetting in\\ |\@combinedblfloats|.
1092 %    \begin{macrocode}
1093   \global \@dbltopnum \m@ne
1094 %<*trace>
1095     \fl@trace{dbltopnum set to -1 (= \the \@dbltopnum) (topnewpage)}%
1096 %</trace>
1097 %    \end{macrocode}
1098 %    At points such as this we need to check that there is still a
1099 %    minimal amount of room left on the page; this uses an arbitrary
1100 %    small value at present; but note that this value is larger than
1101 %    that used when checking that page is too full of normal floats.
1103 %    If there is little room left we just force a page-break, OK?
1104 %    This involves producing two empty columns.  The second empty
1105 %    column may be produced by |\output|, in which case an extra,
1106 %    misleading, warning will be generated, OK?  (This happens only
1107 %    when there is too little room left on the page for any float.)
1108 %    Otherwise (\ie if the size is such that it is allowed as a normal
1109 %    float) the extra |\@emptycol| will be invoked in the second
1110 %    column by the conditional code guarded by the |\if@firstcolumn|
1111 %    test.
1113 %    I now think that the cut-off point here should be |3\baselineskip|,
1114 %    but we make it a bit less so that 3 lines of text will be
1115 %    allowed, OK?
1117 %    Since this happens only when there is nothing on the page but the
1118 %    `top-box', the empty box should not cause any problem other than
1119 %    some overfull box messages, which is not entirely misleading.
1121 %    Here we need two page-ends since both columns need to be empty.
1122 % \task{???}{Make it less arbitrary?}
1123 % \changes{v1.0j}{1993/12/17}{Page room test added}
1124 % \changes{v1.0l}{1994/03/15}{Warning added: it should be improved}
1125 % \changes{v1.0m}{1994/04/24}{Message changed to give more info}
1126 % \changes{v1.0n}{1994/04/30}{Message changed for Frank}
1127 % \changes{v1.0n}{1994/04/30}{Empty column action added:
1128 % \cs{@emptycol}}
1129 % \changes{v1.0n}{1994/04/30}{Cut-off point changed to
1130 % 3\cs{baselineskip}}
1131 % \changes{v1.1t}{1996/05/24}{Cut-off point changed to
1132 % 2.5\cs{baselineskip}}
1133 %    \begin{macrocode}
1134   \ifdim \@colht<2.5\baselineskip
1135     \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
1136                 too tall on page \thepage}%
1137     \@emptycol
1138     \if@firstcolumn
1139     \else
1140       \@emptycol
1141     \fi
1142   \else
1143     \global \vsize \@colht
1144     \global \@colroom \@colht
1145     \@floatplacement
1146   \fi
1148 %    \end{macrocode}
1149 %  \end{macro}
1150 %  \end{macro}
1153 %  \begin{macro}{\output}
1154 % \changes{v1.0f}{1993/12/05}{Command changed}
1155 %  \begin{macro}{\@specialoutput}
1156 % \changes{v0.1c}{1993/11/23}{Command changed}
1157 % \changes{v1.0f}{1993/12/06}{Unboxing of 255 added to rescue writes}
1158 %    This needs some small adjustments.  We cannot
1159 %    guarantee that the float mechanism will interact correctly with
1160 %    this stuff, but that mechanism does not always work properly
1161 %    with footnotes already.
1163 %    RmS 91/09/29:
1165 %    added reset of |\par| to the output routine.
1166 %    This avoids problems when the output routine is
1167 %    called within a list where |\par| may be a no-op.
1169 %    \begin{macrocode}
1170 \output {%
1171   \let \par \@@par
1172   \ifnum \outputpenalty<-\@M
1173     \@specialoutput
1174   \else
1175     \@makecol
1176     \@opcol
1177 %    \end{macrocode}
1178 %    Moved to |\@opcol|: |\@floatplacement|.
1179 %    \begin{macrocode}
1180     \@startcolumn
1181 %    \end{macrocode}
1182 %    This loop could be replaced by an |\expandafter| tail
1183 %    recursion in |\@startcolumn|.
1184 %    \begin{macrocode}
1185     \@whilesw \if@fcolmade \fi
1186       {%
1187 %<*trace>
1188        \fl@trace{PAGE: float \if@twocolumn column \else page \fi
1189                     completed}%
1190 %</trace>
1191        \@opcol\@startcolumn}%
1192   \fi
1193   \ifnum \outputpenalty>-\@Miv
1194 %    \end{macrocode}
1195 %    At points such as this we need to check that there is still a
1196 %    minimal amount of room left on the page; this uses an arbitrary
1197 %    small value at present.  If there is little room left we just
1198 %    force a page-break, OK?
1200 %    This bit is essential only if a float has just been processed so
1201 %    maybe it should be moved; but this is the natural place at which
1202 %    to set the vsize and a test would need to be done anyway.  A
1203 %    check has been added to ensure that there really has been a
1204 %    change in the value of |\@colroom|.
1206 %    Since this happens only when there is nothing on the page but
1207 %    floats, the empty box should not cause any problem other than
1208 %    some overfull box messages, which is not entirely misleading.
1210 %    The twocolumn case does not need any extra code here since this
1211 %    is the |\output| itself; in the second column there will still
1212 %    not be enough room left so |\@emptycol| will be executed again
1213 %    when the OR is called by the-page builder when it gets to the
1214 %    penalty inserted by the first execution.  (The page-builder is
1215 %    never invoked whilst the OR is being executed since it builds a
1216 %    inner vlist; thus any conditional code for the two-column case
1217 %    within |\output| may not get executed with the correct value of
1218 %    |\if@firstcolumn|.
1220 % \task{???}{Make it less arbitrary?}
1221 % \changes{v1.0j}{1993/12/17}{Page room test added}
1222 % \changes{v1.0m}{1994/04/24}{Message changed to give more info and
1223 % `top' removed}
1224 % \changes{v1.0n}{1994/04/30}{Extra empty column added for
1225 % twocolumn case (wrong, see below)}
1226 % \changes{v1.0n}{1994/04/30}{Extra empty column added for
1227 % twocolumn case}
1228 % \changes{v1.0n}{1994/04/30}{Empty column action added:
1229 % \cs{@emptycol}}
1230 % \changes{v1.0n}{1994/04/30}{Cut-off point changed to
1231 % 2\cs{baselineskip}}
1232 % \changes{v1.1t}{1996/05/24}{Cut-off point changed to
1233 % 1.5\cs{baselineskip}}
1234 % \changes{v1.1t}{1996/05/24}{Check that \cs{@colroom} is less
1235 % than \cs{vsize}, indicating that a float has been added}
1236 % \changes{v1.1u}{1996/05/25}{Correct the above check}
1237 % \changes{v1.2c}{1997/11/09}{Remove incorrect code: only one
1238 % \cs{@emptycol} is needed here}
1239 %    \begin{macrocode}
1240     \ifdim \@colroom<1.5\baselineskip
1241       \ifdim \@colroom<\textheight
1242         \@latex@warning@no@line {Text page \thepage\space
1243                                contains only floats}%
1244         \@emptycol
1245 %         \if@twocolumn
1246 %           \if@firstcolumn
1247 %           \else
1248 %             \@emptycol
1249 %           \fi
1250 %         \fi
1251       \else
1252         \global \vsize \@colroom
1253       \fi
1254     \else
1255       \global \vsize \@colroom
1256     \fi
1257   \else
1258     \global \vsize \maxdimen
1259   \fi
1261 %    \end{macrocode}
1263 % \begin{oldcomments}
1264 % CHANGES TO \@specialoutput:
1265 % * \penalty\z@ changed to \penalty\interlinepenalty so \samepage
1266 %   works properly with figure and table environments.
1267 %   (Changed 23 Oct 86)
1269 % * Definition of \@specialoutput changed 26 Feb 88 so \@pageht and
1270 %   \@pagedp aren't changed for a marginal note.
1271 %   (Change suggested by Chris Rowley.)
1272 % \end{oldcomments}
1274 %    \begin{macrocode}
1275 \gdef\@specialoutput{%
1276    \ifnum \outputpenalty>-\@Mii
1277      \@doclearpage
1278    \else
1279      \ifnum \outputpenalty<-\@Miii
1280        \ifnum \outputpenalty<-\@MM \deadcycles \z@ \fi
1281        \global \setbox\@holdpg \vbox {\unvbox\@cclv}%
1282      \else
1283 %    \end{macrocode}
1284 %    Note that |\boxmaxdepth| should not be set here since we wish to
1285 %    record the natural depth of the holdpg box.
1287 %    This is changed so as to not lose anything, such as writes
1288 %    and marks, which may get into box 255 and should be returned to
1289 %    the list.  This should only happen when the first penalty in the
1290 %    mechanism is discarded and therefore |\@holdpg| should always be
1291 %    void in this case.  This can happen because a penalty is
1292 %    discarded whenever there is no box on the list.
1294 %    It was just: |\setbox\@tempboxa \box \@cclv|.
1296 %    The last box which is removed is the box put there by the
1297 %    double-penalty mechanism.  The |\unskip| then removes the
1298 %    |\topskip| which is put there since the box is the first on the
1299 %    page.
1300 % \task{CAR/FMi}{Is it more efficient to check whether the holdpg box
1301 % is void and then act accordingly?}
1302 %    \begin{macrocode}
1303        \global \setbox\@holdpg \vbox{%
1304                       \unvbox\@holdpg
1305                       \unvbox\@cclv
1306 %    \end{macrocode}
1307 %    We must now remove the box added by the float mechanism and the
1308 %    |\topskip| glue therefore added above it by \TeX.
1309 %    \begin{macrocode}
1310                       \setbox\@tempboxa \lastbox
1311                       \unskip
1312                                      }%
1313 %    \end{macrocode}
1314 %    These two are needed as separate dimensions only by
1315 %    |\@addmarginpar|; for other purposes we put the whole size into
1316 %    |\@pageht| (see below).
1317 %    \begin{macrocode}
1318        \@pagedp \dp\@holdpg
1319        \@pageht \ht\@holdpg
1320        \unvbox \@holdpg
1321        \@next\@currbox\@currlist{%
1322          \ifnum \count\@currbox>\z@
1323 %    \end{macrocode}
1324 %    Putting the whole size into |\@pageht| (see above).
1325 %    \begin{macrocode}
1326            \advance \@pageht \@pagedp
1327            \ifvoid\footins \else
1328              \advance \@pageht \ht\footins
1329              \advance \@pageht \skip\footins
1330              \advance \@pageht \dp\footins
1331            \fi
1332            \ifvbox \@kludgeins
1333 %    \end{macrocode}
1334 %    We want to make the adjustment due to this insert only if the
1335 %    non-star form is used.  The *-form will probably not work with
1336 %    floats, but maybe it still could make some adjustment here even
1337 %    so?
1338 %    \begin{macrocode}
1339              \ifdim \wd\@kludgeins=\z@
1340                \advance \@pageht \ht\@kludgeins
1341 %<*trace>
1342                \fl@trace {Extra size added: \the \ht\@kludgeins}%
1343 %</trace>
1344              \fi
1345            \fi
1346 %    \end{macrocode}
1347 %    This version puts the inserts back just before the additional
1348 %    material; it could be moved earlier, before unboxing the
1349 %    page-so-far.  Neither is guaranteed not to put things on the wrong
1350 %    page.  This version is similar to the original version.
1351 %    \begin{macrocode}
1352            \@reinserts
1353            \@addtocurcol
1354          \else
1355            \@reinserts
1356            \@addmarginpar
1357          \fi
1358          }\@latexbug
1359 %    \end{macrocode}
1360 %    A 2e change: use |\addpenalty| instead of |\penalty| here.  Some
1361 %    penalty is needed to create a potential break-point immediately
1362 %    after the reinserts (or the marginal).  Otherwise there can be no
1363 %    possibility to break here and this can cause the reinserts or the
1364 %    marginal to appear on the next page (which is often incorrect).
1365 %    However, if the nobreak flag is true, a |\nobreak| must be
1366 %    correct.
1367 % \changes{v1.1i}{1994/11/21}{Added \cs{if@nobreak} test}
1368 % \changes{v1.1z}{1996/10/24}{Added \cs{nobreak} as appropriate}
1369 %    \begin{macrocode}
1370        \ifnum \outputpenalty<\z@
1371          \if@nobreak
1372            \nobreak
1373          \else
1374            \addpenalty \interlinepenalty
1375          \fi
1376        \fi
1377      \fi
1378    \fi
1380 %</2ekernel|fltrace>
1381 %    \end{macrocode}
1382 %  \end{macro}
1383 %  \end{macro}
1385 % \begin{macro}{\@testwrongwidth}
1386 % \begin{macro}{\f@depth}
1387 % \changes{v1.2n}{2015/02/21}{macro added(latexrelease)}
1389 % Test if the float box has the wrong width when trying to place it
1390 % into some area. (Actually
1391 % the test is for a conventional depth setting rather than for the
1392 % width of the float. For that reason the box depth was explicitly
1393 %   tailored when the float was created).
1394 %    \begin{macrocode}
1395 %<latexrelease>\IncludeInRelease{2015/01/01}%
1396 %<latexrelease>                 {\@testwrongwidth}{float order in 2-column}%
1397 %<*2ekernel|latexrelease|fltrace>
1398 %    \end{macrocode}
1400 %    \begin{macrocode}
1401 \def\@testwrongwidth #1{%
1402   \ifdim\dp#1=\f@depth
1403 %<*trace>
1404     \fl@trace{\string#1 
1405               \ifdim\f@depth=\z@ single \else double \fi 
1406               column float -- ok}%
1407 %</trace>
1408   \else
1409     \global\@testtrue
1410 %<*trace>
1411     \fl@trace{\string#1
1412               \ifdim\f@depth=\z@ double \else single \fi
1413               column float -- wrong}%
1414 %</trace>
1415   \fi}%
1416 %    \end{macrocode}
1418 % Normally looking for single column floats, which have zero depth.
1419 %    \begin{macrocode}
1420 \let\f@depth\z@
1421 %    \end{macrocode}
1423 %    \begin{macrocode}
1424 %</2ekernel|latexrelease|fltrace>
1425 %<latexrelease>\EndIncludeInRelease
1426 %<latexrelease>\IncludeInRelease{0000/00/00}%
1427 %<latexrelease>                 {\@testwrongwidth}{float order in 2-column}%
1428 %<latexrelease>\let\@testwrongwidth\@undefined
1429 %<latexrelease>\let\f@depth\@undefined
1430 %<latexrelease>\EndIncludeInRelease
1431 %    \end{macrocode}
1432 % \end{macro}
1433 % \end{macro}
1436 %  \begin{macro}{\@doclearpage}
1437 %  \task{CAR/FMi}{Investigate better float clearance}
1438 %  \task{CAR/FMi}{Put non-boxes back in the `right place', or nowhere?}
1439 %    This is a very much an emergency action, just dumping everything:
1440 %    footnotes first then floats.  A more sophisticated version is
1441 %    needed; but even more urgent is a bug-free version (see, for
1442 %    example, pr/3528).
1444 %    Also, it puts any left-over non-boxes (writes, specials, etc.) back
1445 %    after any float pages created: this is a very bad bug since,
1446 %    for example, a kludge insert will be in quite the wrong place
1447 %    and, worse, be irremovable and uncancelable.
1449 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
1450 % All the remaining changes are replacing the double column defer list
1451 % or inserting the extra test |\@testwrongwidth|\marg{box} at suitable
1452 % places. That is at places where a box is taken off the deferlist.
1453 %    \begin{macrocode}
1454 %<latexrelease>\IncludeInRelease{2015/01/01}{\@doclearpage}%
1455 %<latexrelease>                             {float order in 2-column}%
1456 %<*2ekernel|latexrelease>
1457 \def \@doclearpage {%
1458      \ifvoid\footins
1459 %    \end{macrocode}
1460 % \changes{v1.2n}{2015/01/14}{Empty kludgeins box if necessary, pr/3528}
1461 %    \begin{macrocode}
1462        \ifvbox\@kludgeins
1463          {\setbox \@tempboxa \box \@kludgeins}%
1464 %<*trace>
1465          \fl@trace {kludgeins box made void}%
1466 %</trace>
1467        \fi
1468        \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
1469        \setbox\@tempboxa\box\@cclv
1470        \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
1471        \global \let \@toplist \@empty
1472        \global \let \@botlist \@empty
1473        \global \@colroom \@colht
1474        \ifx \@currlist\@empty
1475        \else
1476           \@latexerr{Float(s) lost}\@ehb
1477           \global \let \@currlist \@empty
1478        \fi
1479        \@makefcolumn\@deferlist
1480        \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
1481        \if@twocolumn
1482          \if@firstcolumn
1483 %    \end{macrocode}
1485 %    \begin{macrocode}
1486            \xdef\@deferlist{\@dbltoplist\@deferlist}%
1487 %    \end{macrocode}
1489 %    \begin{macrocode}
1490            \global \let \@dbltoplist \@empty
1491            \global \@colht \textheight
1492            \begingroup
1493               \@dblfloatplacement
1494 %    \end{macrocode}
1496 %    \begin{macrocode}
1497               \@makefcolumn\@deferlist
1498               \@whilesw\if@fcolmade \fi{\@outputpage
1499                                         \@makefcolumn\@deferlist}%
1500 %    \end{macrocode}
1502 %    \begin{macrocode}
1503            \endgroup
1504          \else
1505            \vbox{}\clearpage
1506          \fi
1507        \fi
1508 %    \end{macrocode}
1509 %    the next line is needed to avoid losing floats in certain
1510 %    circumstances a single call to the original |\doclearpage|
1511 %    will now no longer output all floats.
1512 % \changes{v1.2b}{2000/09/24}{FMi: ensure \cs{doclearpage}
1513 %     is called again until all floats are output.}
1514 %    \begin{macrocode}
1515        \ifx\@deferlist\@empty \else\clearpage \fi
1516      \else
1517        \setbox\@cclv\vbox{\box\@cclv\vfil}%
1518        \@makecol\@opcol
1519        \clearpage
1520      \fi
1522 %</2ekernel|latexrelease>
1523 %<latexrelease>\EndIncludeInRelease
1524 %<latexrelease>\IncludeInRelease{0000/00/00}{\@doclearpage}%
1525 %<latexrelease>                             {float order in 2-column}%
1526 %<latexrelease>\def \@doclearpage {%
1527 %<latexrelease>     \ifvoid\footins
1528 %    \end{macrocode}
1529 % \changes{v1.2l}{2004/02/07}{Empty kludgeins box if necessary, pr/3528}
1530 %    We empty any left over kludge insert box here; this is a temporary fix.
1531 %    It should perhaps be applied to one page of cleared floats, but
1532 %    who cares?  The whole of this stuff needs completely redoing for
1533 %    many such reasons.
1534 %    \begin{macrocode}
1535 %<latexrelease>       \ifvbox\@kludgeins
1536 %<latexrelease>         {\setbox \@tempboxa \box \@kludgeins}%
1537 %<*trace>
1538 %<latexrelease>         \fl@trace {kludgeins box made void}%
1539 %</trace>
1540 %<latexrelease>       \fi
1541 %<latexrelease>       \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
1542 %<latexrelease>       \setbox\@tempboxa\box\@cclv
1543 %<latexrelease>       \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
1544 %    \end{macrocode}
1545 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
1546 %    \begin{macrocode}
1547 %<latexrelease>       \global \let \@toplist \@empty
1548 %<latexrelease>       \global \let \@botlist \@empty
1549 %<latexrelease>       \global \@colroom \@colht
1550 %<latexrelease>       \ifx \@currlist\@empty
1551 %<latexrelease>       \else
1552 %<latexrelease>          \@latexerr{Float(s) lost}\@ehb
1553 %    \end{macrocode}
1554 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
1555 %    \begin{macrocode}
1556 %<latexrelease>          \global \let \@currlist \@empty
1557 %<latexrelease>       \fi
1558 %<latexrelease>       \@makefcolumn\@deferlist
1559 %<latexrelease>       \@whilesw\if@fcolmade \fi
1560 %<latexrelease>                     {\@opcol\@makefcolumn\@deferlist}%
1561 %<latexrelease>       \if@twocolumn
1562 %<latexrelease>         \if@firstcolumn
1563 %<latexrelease>           \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}%
1564 %    \end{macrocode}
1565 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
1566 %    \begin{macrocode}
1567 %<latexrelease>           \global \let \@dbltoplist \@empty
1568 %<latexrelease>           \global \@colht \textheight
1569 %<latexrelease>           \begingroup
1570 %<latexrelease>              \@dblfloatplacement
1571 %<latexrelease>              \@makefcolumn\@dbldeferlist
1572 %<latexrelease>              \@whilesw\if@fcolmade \fi
1573 %<latexrelease>                    {\@outputpage\@makefcolumn\@dbldeferlist}%
1574 %<latexrelease>           \endgroup
1575 %<latexrelease>         \else
1576 %<latexrelease>           \vbox{}\clearpage
1577 %<latexrelease>         \fi
1578 %<latexrelease>       \fi
1579 %<latexrelease>     \else
1580 %<latexrelease>       \setbox\@cclv\vbox{\box\@cclv\vfil}%
1581 %<latexrelease>       \@makecol\@opcol
1582 %<latexrelease>       \clearpage
1583 %<latexrelease>     \fi
1584 %<latexrelease>  }%
1585 %<latexrelease>\EndIncludeInRelease
1586 %    \end{macrocode}
1587 % \end{macro}
1589 %  \begin{macro}{\@opcol}
1590 % \changes{v1.0f}{1993/12/05}{Command changed}
1591 % \changes{v1.0f}{1993/12/05}{Hook added}
1592 % \changes{v1.0j}{1993/12/17}{Hook removed}
1593 %    Several changes in detail here.
1595 %    \begin{macrocode}
1596 %<*2ekernel|fltrace>
1597 \def \@opcol {%
1598   \if@twocolumn
1599     \@outputdblcol
1600   \else
1601     \@outputpage
1602 %<*trace>
1603     \fl@trace{PAGE: one column (float? see above) page completed}%
1604 %</trace>
1605 %    \end{macrocode}
1606 %    Not needed since it comes after |\@outputpage|:
1607 %    \begin{macrocode}
1608 %   \global\@colht\textheight
1609   \fi
1610 %    \end{macrocode}
1611 %    These do not need to be done every time |\@opcol| is used: they
1612 %    should be grouped together since they all need to be done at the
1613 %    end of the non-special output routine, or at the end of a clearpage
1614 %    one.
1615 %    \begin{macrocode}
1616   \global \@mparbottom \z@ \global \@textfloatsheight \z@
1617   \@floatplacement
1619 %</2ekernel|fltrace>
1620 %    \end{macrocode}
1621 %  \end{macro}
1624 %  \begin{macro}{\@makecol}
1625 % \changes{v0.1c}{1993/11/23}{Command changed}
1626 % \changes{v1.0b}{1993/11/29}{\cs{@makespecialcolbox} added}
1627 %    We must rewrite this macro to alllow for variations in page-makeup
1628 %    required by changes in page-length.
1630 %    This uses a different macro if a special-length column is being
1631 %    produced.
1633 %    \begin{macrocode}
1634 %<*2ekernel>
1635 \gdef \@makecol {%
1636    \ifvoid\footins
1637      \setbox\@outputbox \box\@cclv
1638    \else
1639      \setbox\@outputbox \vbox {%
1640 %    \end{macrocode}
1641 %    This |\boxmaxdepth| setting is to ensure that  deep footnotes
1642 %    do not overwrite the footer (on account of the negative skip
1643 %    added later): it should use |\@maxdepth| otherwise the change is
1644 %    pointless when there are footnotes.
1645 % \task{CAR}{Investigate providing an option to put the footnotes
1646 %    below the bottom floats.}
1648 %    But see also its use when combining floats.
1649 % \changes{v1.0l}{1994/03/15}{\cs{maxdepth} changed to \cs{@maxdepth}}
1650 %    \begin{macrocode}
1651        \boxmaxdepth \@maxdepth
1652 %    \end{macrocode}
1654 % \changes{v1.2e}{1999/01/06}{Added negative vskip, as when processing
1655 %      outputbox below: suggested by Fred Bartlett pr/2892}
1656 % \changes{1.2i}{2000/07/12}{Removed negative vskip, as it gives
1657 %    unacceptable results when the depth is large: pr/3189}
1658 % \changes{v1.2m}{2004/10/20}{Removed dead code}
1659 % \task{CAR}{As can be seen from the above two changes, getting a good
1660 %    layout here is difficult: fix!}
1661 %    \begin{macrocode}
1662 %       \@tempdima\dp\@cclv
1663        \unvbox \@cclv
1664 %       \vskip-\@tempdima
1665        \vskip \skip\footins
1666 %    \end{macrocode}
1667 % \changes{v1.1a}{1994/10/31}
1668 %     {(DPC/CAR)  Colour resetting moved to here}
1669 %    \begin{macrocode}
1670        \color@begingroup
1671          \normalcolor
1672          \footnoterule
1673          \unvbox \footins
1674        \color@endgroup
1675        }%
1676    \fi
1677 %    \end{macrocode}
1678 %    The h floats have now been finally committed to this page so we
1679 %    can reset their list.  The top and bottom floats are then added
1680 %    to the page.
1681 % \changes{v1.2k}{2003/12/16}{Ensure that \cs{@elt} has a defined
1682 %                             state (pr/3586)}
1683 %    \begin{macrocode}
1684    \let\@elt\relax
1685    \xdef\@freelist{\@freelist\@midlist}%
1686 %    \end{macrocode}
1687 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
1688 %    \begin{macrocode}
1689    \global \let \@midlist \@empty
1690    \@combinefloats
1691 %    \end{macrocode}
1692 %    The variations start here in case |\enlargethispage| has
1693 %    been used.
1694 %    \begin{macrocode}
1695    \ifvbox\@kludgeins
1696      \@makespecialcolbox
1697    \else
1698 %    \end{macrocode}
1699 %    This extra reboxing is only needed to add the
1700 %    |\@texttop| and |\@textbotttom| but this could be done earlier,
1701 %    when the floats are added.
1703 %    The |\boxmaxdepth| resetting here will have no effect unless
1704 %    |\@textbottom| ends with a box or rule.  So is this (or possibly
1705 %    |\@maxdepth|) the correct value?
1707 %    The |\vskip -\dimen@|
1708 %    ensures that the visible depth of the box does not
1709 %    affect the placement of anything on the page.
1710 %    Thus very deep pages will overprint the footer; but these should
1711 %    have been prevented by suitable settings of the maxdepths at
1712 %    appropriate times.
1714 %    If |\@textbottom| ends with a box or rule of non-zero depth
1715 %    then this skip adjustment should be done again after it.
1717 %    I think that the final boxing of the main text page could have a
1718 %    common ending which may make it simpler to see what is going on.
1720 %    This needs further investigation, especially in the `special
1721 %    case'.
1722 %    \task{CAR}{Further investigation of makecol}
1724 %    Also, the |\boxmaxdepth| setting here affects what happens within
1725 %    |\@texttop| and |\@textbottom|, should it?  Is it needed at all?
1726 % \changes{v1.0l}{1994/03/15}{Removed boxmaxdepth setting.}
1728 % RmS 91/10/22: Replaced |\dimen128| by |\dimen@|.
1730 %    \begin{macrocode}
1731      \setbox\@outputbox \vbox to\@colht {%
1732 %       \boxmaxdepth \maxdepth                   %??
1733        \@texttop
1734        \dimen@ \dp\@outputbox
1735        \unvbox \@outputbox
1736        \vskip -\dimen@
1737        \@textbottom
1738        }%
1739    \fi
1740    \global \maxdepth \@maxdepth
1742 %    \end{macrocode}
1743 %  \end{macro}
1745 %  \begin{macro}{\@reinserts}
1746 % \changes{v1.0e}{1993/12/01}{Command added}
1747 %    This is the code which reinserts the inserts.  It puts them all
1748 %    in one place; this can make some of them come out on the wrong
1749 %    page.
1750 %    It has been put into a separate macro to expedite experimentation.
1751 %    \begin{macrocode}
1752 \gdef \@reinserts{%
1753   \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
1754   \ifvbox\@kludgeins\insert\@kludgeins
1755                       {\unvbox\@kludgeins}\fi
1757 %</2ekernel>
1758 %    \end{macrocode}
1759 %  \end{macro}
1763 %  \begin{macro}{\@makespecialcolbox}
1764 % \changes{v1.0b}{1993/11/29}{Command added}
1765 %    This implements certain variations in page-makeup.
1766 %    \begin{macrocode}
1767 %<*2ekernel|fltrace>
1768 \gdef \@makespecialcolbox {%
1769 %<*trace>
1770    \fl@trace{Kludgeins ht \the\ht\@kludgeins\space
1771                            dp \the\dp\@kludgeins\space
1772                            wd \the\wd\@kludgeins}%
1773 %</trace>
1774 %    \end{macrocode}
1775 %    First we find the natural height of the column.
1777 %    See above for discussion of what is happening here.
1779 %    This needs further investigation, especially in this `special
1780 %    case'.
1781 % \changes{v1.0k}{1994/02/08}{boxmaxdepth setting removed}
1782 %    \begin{macrocode}
1783    \setbox\@outputbox \vbox {%
1784      \@texttop
1785      \dimen@ \dp\@outputbox
1786      \unvbox\@outputbox
1787      \vskip-\dimen@
1788      }%
1789    \@tempdima \@colht
1790    \ifdim \wd\@kludgeins>\z@
1791 %    \end{macrocode}
1792 %    Note that in this case (the *-version), the height of the
1793 %    |\@kludgeins| box is not used since its value is somewhat
1794 %    arbitrary: it need only be big enough to ensure that the
1795 %    page-break is not taken prematurely.
1797 %    Here we calculate how much vertical space needs to be added in
1798 %    order to enable the column to fit into a box of size |\@colht|
1799 %    using the best information we have about the amount of shrink
1800 %    available (another thing which is known internally about a box,
1801 %    but cannot be accessed at the \TeX{} level!).
1803 %    This needs \TeX3 otherwise |\pageshrink| is zero anyway; it may
1804 %    not be exactly the figure we wish as it is the total available
1805 %    from the all the material collected before the page-break
1806 %    decision is made.  It will, we think, always be an overestimate
1807 %    of the actual shrink in the box; therefore this should always
1808 %    force the shortest possible column with the possibility of an
1809 %    overfull box.
1811 %    This should work for bothe flush- and ragged-bottom setting since
1812 %    it makes the contents no smaller than the size (|\@colht|) of the
1813 %    box into which they are put.
1815 %    Their should perhaps be an upper limit, of 0pt?, on the extra
1816 %    space added to force shrinking.
1817 %    \task{CAR}{Further investigation of kludge-* space}
1819 %    See above for a discussion of the |\boxmaxdepth| setting here.
1821 % \changes{v1.0k}{1994/02/08}{boxmaxdepth setting added}
1822 % \changes{v1.0l}{1994/03/15}{Removed boxmaxdepth setting.}
1823 %    \begin{macrocode}
1824      \advance \@tempdima -\ht\@outputbox
1825      \advance \@tempdima \pageshrink
1826 %<*trace>
1827      \fl@trace {Natural ht of col: \the \ht\@outputbox}%
1828      \fl@trace {\string \@colht: \the \@colht}%
1829      \fl@trace {Pageshrink added: \the \pageshrink}%
1830      \fl@trace {Hence, space added: \the \@tempdima}%
1831 %</trace>
1832      \setbox\@outputbox \vbox to \@colht {%
1833 %       \boxmaxdepth \maxdepth
1834        \unvbox\@outputbox
1835        \vskip \@tempdima
1836        \@textbottom
1837        }%
1838 %    \end{macrocode}
1839 %    For the unstarred version, the final size of the page is
1840 %    precisely specified.  Therefore, at least for the flush-bottom
1841 %    case, we need to ensure that, visually, it has this size exactly.
1843 %    Thus we calculate this size and set the material in a box of this
1844 %    size, which is then put into a box of size |\@colht| with |\vss|
1845 %    at the bottom.
1846 %    \begin{macrocode}
1847    \else
1848      \advance \@tempdima -\ht\@kludgeins
1849 %<*trace>
1850      \fl@trace {Natural ht of col: \the \ht\@outputbox}%
1851      \fl@trace {\string \@colht: \the \@colht}%
1852      \fl@trace {Extra size added: -\the \ht \@kludgeins}%
1853      \fl@trace {Hence, height of inner box: \the \@tempdima}%
1854      \fl@trace {Max? pageshrink available: \the \pageshrink}%
1855 %</trace>
1856 %    \end{macrocode}
1857 %    This type of final packaging could be done always; this may
1858 %    simplify all of this page-makeup.
1860 %    It is not necessary to set |\boxmaxdepth| here since the
1861 %    |\@outputbox| ends with glue.
1862 % \changes{v1.0k}{1994/02/03}{correct mistakes in the documentation}
1863 %    \begin{macrocode}
1864      \setbox \@outputbox \vbox to \@colht {%
1865        \vbox to \@tempdima {%
1866          \unvbox\@outputbox
1867          \@textbottom}%
1868        \vss}%
1869    \fi
1870 %    \end{macrocode}
1871 %    Finally we need to explicitly make the insert box void.
1872 %    \begin{macrocode}
1873    {\setbox \@tempboxa \box \@kludgeins}%
1874 %<*trace>
1875      \fl@trace {kludgeins box made void}%
1876 %</trace>
1878 %</2ekernel|fltrace>
1879 %    \end{macrocode}
1880 %  \end{macro}
1882 %  \begin{macro}{\@texttop}
1883 %  \begin{macro}{\@textbottom}
1884 %    These do nothing as a default.
1885 %    \begin{macrocode}
1886 %<*2ekernel>
1887 \let \@texttop \relax
1888 \let \@textbottom \relax
1889 %    \end{macrocode}
1890 %  \end{macro}
1891 %  \end{macro}
1893 %  \begin{macro}{\@resetactivechars}
1894 %  \begin{macro}{\@activechar@info}
1896 % \changes{v1.0n}{1994/04/30}{\cs{@activechar@warning} changed to
1897 % \cs{@activechar@info}}
1898 % RmS 93/09/06:
1899 % added hook to protect against certain active characters in the
1900 % output routine. Default checks are for active space and end-of-line.
1901 % \changes{v1.0u}{1994/05/23}{Added \cs{MessageBreak}}
1902 %    \begin{macrocode}
1903 \def\@activechar@info #1{%
1904       \@latex@info@no@line {Active #1 character found while
1905                             output routine is active
1906                             \MessageBreak
1907                             This may be a bug in a package file
1908                             you are using}%
1910 %    \end{macrocode}
1912 %    Do not put any spaces in this next bit!
1913 % \changes{1.2f}{1999/10/09}{Reset definition of active prime
1914 %    character (used in math mode)}
1915 %    \begin{macrocode}
1916 \begingroup
1917 \obeylines\obeyspaces%
1918 \catcode`\'\active%
1919 \gdef\@resetactivechars{%
1920 \def^^M{\@activechar@info{EOL}\space}%
1921 \def {\@activechar@info{space}\space}%
1922 \let'\active@math@prime}%
1923 \endgroup
1924 %    \end{macrocode}
1925 %  \end{macro}
1926 %  \end{macro}
1928 %  \begin{macro}{\@outputpage}
1929 % \changes{v1.0f}{1993/12/05}{Command changed}
1930 %  \begin{macro}{\@shipoutsetup}
1931 % \changes{v1.0f}{1993/12/05}{Command added}
1932 % \changes{v1.1s}{1995/11/10}{Command removed}
1933 %  \begin{macro}{\@writesetup}
1934 % \changes{v1.1s}{1995/11/10}{Command removed}
1935 % \changes{v1.1o}{1995/07/21}{Command added}
1936 % \changes{v1.0f}{1993/12/05}{\cs{@startpagehook} added}
1937 % \changes{v1.0j}{1993/12/17}{---and then removed}
1938 % \changes{v1.0p}{1994/05/12}{\cs{normalcolor}added}
1939 % \changes{v1.0s}{1994/05/20}{Added setting of \cs{protect}
1940 %                    during \cs{shipout}.}
1941 % \changes{v1.0u}{1994/05/23}{Changed resetting of \cs{protect} after
1942 % shipout to use \cs{aftergroup}}
1943 % \changes{v1.1b}{1994/11/05}
1944 %         {Use new \cs{color@hbox} concept.}
1945 % \changes{v1.1b}{1994/11/05}
1946 %         {Change protect settings for new-style, protect-free
1947 %         aux-files.}
1948 % \changes{v1.1c}{1994/11/05}
1949 %         {Add new \cs{AtBeginDvi} concept}
1950 % \changes{v1.1e}{1994/11/10}
1951 %         {Modify \cs{protect} setting}
1952 % \changes{v1.1f}{1994/11/14}
1953 %         {Modify new \cs{AtBeginDvi} concept}
1954 % \changes{v1.1o}{1995/07/21}
1955 %         {New, experimental, versions: need in-lining}
1956 % \changes{v1.1s}{1995/11/10}{In-lined}
1957 % \changes{v1.1w}{1996/09/21}{Added \cs{@parboxrestore} and made
1958 % consequent deletions: wait for the howls of protest}
1960 %    The |\color@hbox| hooks here are used to avoid putting just a
1961 %    colour special into an otherwise empty box (in a header or
1962 %    footer).  These boxes are often set to be completely empty and so
1963 %    adding a special produces a very underfull box message.
1965 %    There has been extensive tidying up of the old code here;
1966 %    including the removal of a level of grouping.
1968 %    The setting of |\protect| immediately before the |\shipout|
1969 %    is needed so that protected commands within |\write|s are
1970 %    handled correctly.
1972 %    Within shipout's vbox it is reset to its default value, |\relax|.
1974 %    Resetting it to its default value after the shipout has been
1975 %    completed (and the contents of the writes have been expanded)
1976 %    must be done by use of |\aftergroup|.
1977 %    This is because it must have the value |\relax|
1978 %    before macros coming from other uses of |\aftergroup| within
1979 %    this box are expanded.
1981 %    Putting this into the |\aftergroup| token list does not affect
1982 %    the definition used in expanding the |\write|s because the
1983 %    aftergroup token list is only constructed when popping the
1984 %    save-stack, it is not expanded until after the shipout is
1985 %    completed.
1987 %    Question: should things from an |\aftergroup| within the shipped
1988 %    out box be executed in the environment set up for the writes, or
1989 %    after it finishes?
1991 %    A lot of this code has been in-lined tp prevent mis-use of
1992 %    internal commands as hooks.
1993 %    \begin{macrocode}
1994 \def\@outputpage{%
1995 \begingroup           % the \endgroup is put in by \aftergroup
1996 %    \end{macrocode}
1997 %    Now all the set-up stuff has been in-lined for Frank.
1999 %    First the stuff for the writes.
2001 %    From here \ldots\ was in the command |\@writesetup|.
2002 %    \begin{macrocode}
2003   \let \protect \noexpand
2004 %    \end{macrocode}
2006 %    RmS 93/08/19: Redefined accents to allow changes in font encoding;
2007 %    but exactly why was this needed?
2009 %    The |\catcode`\ = 10| was removed as it was considered useless
2010 %    (presumably because nothing gets tokenised during shipout).
2012 %    This was put in as some error produced active spaces in a mark, I
2013 %    think.
2015 %    Why was the hyphen reset?
2017 %    \begin{macrocode}
2018   \@resetactivechars
2019 %    \end{macrocode}
2020 %    If a page break happens between the start of a list and its first
2021 %    item the |@newlist| will be true and this will mess up any list
2022 %    that is used in the header or footer of the page. So we have to
2023 %    reset that flag.
2024 % \changes{v1.2h}{2000/07/19}
2025 %  {Reset and restore \cs{@if@newlist} for internal/3231}
2026 % \changes{v1.2j}{2001/01/07}
2027 %  {And do it in the right macro! (pr/3286)}
2028 %    \begin{macrocode}
2029   \global\let\@@if@newlist\if@newlist
2030   \global\@newlistfalse
2031 %    \end{macrocode}
2033 % \changes{v1.0q}{1994/05/16}{Changed setting of accents (FMi):
2034 %     with the new encoding setup they can use \cs{let}.
2035 %     It could also use the new internal commands?}
2036 % \changes{v1.1l}{1995/04/24}{Reset \cmd\\ latex/1451 (DPC)}
2037 %    This next hook replaces the following:
2038 %    \begin{verbatim}
2039 %      \let\-\@dischyph
2040 %      \let\'\@acci\let\`\@accii\let\=\@acciii
2041 %      \let\\\@normalcr
2042 %      \let\par\@@par %% 15 Sep 87 (this was once inside the box)
2043 %    \end{verbatim}
2044 %    and it does more than they did; in particular it sets:
2045 %    \begin{verbatim}
2046 %      \parindent\z@
2047 %      \parskip\z@skip
2048 %      \everypar{}%
2049 %      \leftskip\z@skip
2050 %      \rightskip\z@skip
2051 %      \parfillskip\@flushglue
2052 %      \lineskip\normallineskip
2053 %      \baselineskip\normalbaselineskip
2054 %      \sloppy
2055 %    \end{verbatim}
2057 %    \begin{macrocode}
2058   \@parboxrestore
2059 %    \end{macrocode}
2060 %    \ldots\ to here was in the command |\@writesetup|.
2061 %    \begin{macrocode}
2062   \shipout \vbox{%
2063     \set@typeset@protect
2064     \aftergroup \endgroup
2065     \aftergroup \set@typeset@protect
2066                                 % correct? or just restore by ending
2067                                 % the group?
2068 %    \end{macrocode}
2069 %    This first bit has been moved inside the shipped out box.
2071 %    Now the setup inside the shipped out box; this should contain all
2072 %    the stuff that could only affect typesetting; other stuff may need
2073 %    to be reset for the writes also.
2075 %    From here \ldots\ was in the command |\@shipoutsetup|.
2076 %    \begin{macrocode}
2077   \if@specialpage
2078     \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
2079   \fi
2080   \if@twoside
2081     \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
2082          \let\@themargin\oddsidemargin
2083     \else \let\@thehead\@evenhead
2084        \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
2085     \fi
2086   \fi
2087 %    \end{macrocode}
2089 %    The rest was always inside the box.
2091 %    RmS 91/08/15: aded this line:
2092 %    \begin{macrocode}
2093   \reset@font
2094 %    \end{macrocode}
2095 %    RmS 93/08/06 Added |\lineskiplimit=0pt| to guard against it being
2096 %              nonzero: e.g. by |\offinterlineskip| being in effect.
2098 %    There are probably lots of other things that may need resetting.
2100 %    \begin{macrocode}
2101   \normalsize
2102 %    \end{macrocode}
2103 % Reset the space factors.
2104 % \changes{v1.2b}{1997/04/14}
2105 %     {Call \cs{normalsfcodes} (from patch file) latex/2404}
2106 %    \begin{macrocode}
2107   \normalsfcodes
2108 %    \end{macrocode}
2110 % Reset these here (previously reset separately for head and foot)
2111 % \changes{v1.2b}{1997/04/14}
2112 %     {Move \cs{label} and \cs{index} (from patch file)}
2113 %    \begin{macrocode}
2114   \let\label\@gobble
2115   \let\index\@gobble
2116   \let\glossary\@gobble
2117 %    \end{macrocode}
2119 %    \begin{macrocode}
2120   \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
2121 %    \end{macrocode}
2122 %    \ldots\ to here was in the command |\@shipoutsetup|.
2123 %    \begin{macrocode}
2124     \@begindvi
2125     \vskip \topmargin
2126     \moveright\@themargin \vbox {%
2127       \setbox\@tempboxa \vbox to\headheight{%
2128         \vfil
2129         \color@hbox
2130           \normalcolor
2131           \hb@xt@\textwidth{\@thehead}%
2132         \color@endbox
2133         }%                        %% 22 Feb 87
2134       \dp\@tempboxa \z@
2135       \box\@tempboxa
2136       \vskip \headsep
2137       \box\@outputbox
2138       \baselineskip \footskip
2139       \color@hbox
2140         \normalcolor
2141         \hb@xt@\textwidth{\@thefoot}%
2142       \color@endbox
2143       }%
2144     }%
2145 %    \end{macrocode}
2146 %   |\endgroup| now inserted by |\aftergroup|
2148 % Restore |\if@newlist|
2149 %    \begin{macrocode}
2150   \global\let\if@newlist\@@if@newlist
2151 %    \end{macrocode}
2153 %    \begin{macrocode}
2154   \global \@colht \textheight
2155   \stepcounter{page}%
2156 %    \end{macrocode}
2157 %    It is now clear that this does something useful, thanks to Piet
2158 %    van Oostrum.  It is needed because a float page is made without
2159 %    using TeX's page-builder; thus the output routine is never called
2160 %    so the marks are not updated.
2161 %    \begin{macrocode}
2162   \let\firstmark\botmark
2164 %    \end{macrocode}
2165 %  \end{macro}
2166 %  \end{macro}
2167 %  \end{macro}
2169 % \begin{macro}{\@begindvi}
2170 % \changes{v1.1c}{1994/11/05}
2171 %         {Added macro}
2172 % \changes{v1.1f}{1994/11/14}{Use normal box register: why a box?}
2174 %    This unboxes stuff that must appear before anything else in the
2175 %    |.dvi| file, then returns that box register to the free list and
2176 %    cancels itself.
2178 %    The stuff in the box should not add any typeset material to the
2179 %    page.
2180 %    \begin{macrocode}
2181 \def \@begindvi{%
2182   \unvbox \@begindvibox
2183   \global\let \@begindvi \@empty
2185 %    \end{macrocode}
2186 % \end{macro}
2188 % \begin{macro}{\@combinefloats}
2189 % \begin{macro}{\@cflt}
2190 % \changes{v1.0h}{1993/12/12}{name changed}
2191 % \begin{macro}{\@cflb}
2192 %    The |\boxmaxdepth| setting here was not made local to
2193 %    a box so was dangerous.  It is needed only within the box made
2194 %    by |\@cflt| (and not normally even there), so it has been
2195 %    moved there; this also agrees with the original pseudocode.
2197 % \changes{v1.0h}{1993/12/12}{boxmaxdepth setting moved}
2198 %    \begin{macrocode}
2199 \def \@combinefloats {%
2200 %    \boxmaxdepth \maxdepth
2201     \ifx \@toplist\@empty \else \@cflt \fi
2202     \ifx \@botlist\@empty \else \@cflb \fi
2204 %    \end{macrocode}
2206 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
2207 %    \begin{macrocode}
2208 \def \@cflt{%
2209     \let \@elt \@comflelt
2210     \setbox\@tempboxa \vbox{}%
2211     \@toplist
2212     \setbox\@outputbox \vbox{%
2213                              \boxmaxdepth \maxdepth
2214                              \unvbox\@tempboxa
2215                              \vskip -\floatsep
2216                              \topfigrule
2217                              \vskip \textfloatsep
2218                              \unvbox\@outputbox
2219                              }%
2220     \let\@elt\relax
2221     \xdef\@freelist{\@freelist\@toplist}%
2222     \global\let\@toplist\@empty
2224 %    \end{macrocode}
2226 %    \begin{macrocode}
2227 \def \@cflb {%
2228     \let\@elt\@comflelt
2229     \setbox\@tempboxa \vbox{}%
2230     \@botlist
2231     \setbox\@outputbox \vbox{%
2232                              \unvbox\@outputbox
2233                              \vskip \textfloatsep
2234                              \botfigrule
2235                              \unvbox\@tempboxa
2236                              \vskip -\floatsep
2237                              }%
2238     \let\@elt\relax
2239     \xdef\@freelist{\@freelist\@botlist}%
2240     \global \let \@botlist\@empty
2242 %    \end{macrocode}
2243 %  \end{macro}
2244 %  \end{macro}
2245 %  \end{macro}
2247 % \begin{macro}{\@comflelt}
2248 % \begin{macro}{\@comdblflelt}
2249 % \begin{macro}{\@combinedblfloats}
2251 %    \begin{macrocode}
2252 \def\@comflelt#1{\setbox\@tempboxa
2253       \vbox{\unvbox\@tempboxa\box #1\vskip\floatsep}}
2254 %    \end{macrocode}
2256 %    \begin{macrocode}
2257 \def\@comdblflelt#1{\setbox\@tempboxa
2258       \vbox{\unvbox\@tempboxa\box #1\vskip\dblfloatsep}}
2259 %    \end{macrocode}
2261 %    \begin{macrocode}
2262 \def \@combinedblfloats{%
2263   \ifx \@dbltoplist \@empty
2264   \else
2265     \setbox\@tempboxa \vbox{}%
2266     \let \@elt \@comdblflelt
2267     \@dbltoplist
2268     \let \@elt \relax
2269     \xdef \@freelist {\@freelist\@dbltoplist}%
2270     \global\let \@dbltoplist \@empty
2271     \setbox\@outputbox \vbox to\textheight
2272 %    \end{macrocode}
2274 %    The setting of |\boxmaxdepth| here has no effect since the
2275 %    |\@outputbox| should already have depth zero.  Even so, it would
2276 %    have no effect on the layout of the page.
2277 % \changes{v1.0l}{1994/03/15}{Removed boxmaxdepth setting.}
2278 %    \begin{macrocode}
2279       {%\boxmaxdepth\maxdepth   %% probably not needed, CAR
2280        \unvbox\@tempboxa\vskip-\dblfloatsep
2281 %    \end{macrocode}
2282 %    Here we need different typesetting if the top float comes from
2283 %    |\@topnewpage|.
2284 % \changes{v1.0n}{1994/04/30}{Removed rule in topnewpage case}
2285 %    \begin{macrocode}
2286        \ifnum \@dbltopnum>\m@ne
2287          \dblfigrule
2288        \fi
2289        \vskip \dbltextfloatsep
2290        \box\@outputbox
2291        }%
2292   \fi
2294 %</2ekernel>
2295 %    \end{macrocode}
2296 %  \end{macro}
2297 %  \end{macro}
2298 %  \end{macro}
2301 %  \begin{macro}{\@startcolumn}
2302 % \changes{v1.0f}{1993/12/05}{Command changed}
2303 %  \begin{macro}{\@startdblcolumn}
2304 % \changes{v1.0f}{1993/12/05}{Command changed}
2306 %    We could combine (most of) these two into |\@startcol <list>|.
2307 %    Note that |\@xstartcol| was only used once (\ie in
2308 %    |\@startcolumn|); it has therefore been removed.  This is not quite
2309 %    as efficient but it now has the same structure as
2310 %    |\@startdblcolumn|.
2312 %    The empty-list test has been moved to |\@tryfcolumn|.
2314 %    \begin{macrocode}
2315 %<*2ekernel|fltrace>
2316 \def \@startcolumn {%
2317   \global \@colroom \@colht
2318   \@tryfcolumn \@deferlist
2319   \if@fcolmade
2320 %<*trace>
2321     \fl@trace{PAGE: float \if@twocolumn column \else page \fi
2322                 completed}%
2323 %</trace>
2324   \else
2325 %    \end{macrocode}
2326 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
2327 %    \begin{macrocode}
2328     \begingroup
2329       \let \reserved@b \@deferlist
2330       \global \let \@deferlist \@empty
2331       \let \@elt \@scolelt
2332       \reserved@b
2333     \endgroup
2334   \fi
2336 %    \end{macrocode}
2338 %    This one does not need to set |\@colht|.
2340 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
2341 %    \begin{macrocode}
2342 %</2ekernel|fltrace>
2343 %<latexrelease|fltrace>\IncludeInRelease{2015/01/01}%
2344 %<latexrelease|fltrace>  {\@startdblcolumn}{float order in 2-column}%
2345 %<*2ekernel|latexrelease|fltrace>
2346 \def \@startdblcolumn {%
2347   \@tryfcolumn \@deferlist
2348   \if@fcolmade
2349 %<fltrace>    \fl@trace{PAGE: double float page completed}%
2350   \else
2351     \begingroup
2352       \let \reserved@b \@deferlist
2353       \global \let \@deferlist \@empty
2354       \let \@elt \@sdblcolelt
2355       \reserved@b
2356     \endgroup
2357   \fi
2359 %</2ekernel|latexrelease|fltrace>
2360 %<latexrelease|fltrace>\EndIncludeInRelease
2361 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
2362 %<latexrelease|fltrace>  {\@startdblcolumn}{float order in 2-column}%
2363 %<latexrelease|fltrace>\def \@startdblcolumn {%
2364 %    \end{macrocode}
2365 % Not needed since this always comes after |\@outputpage|:
2366 %    \begin{macrocode}
2367 %<latexrelease|fltrace>% \global \@colht \textheight
2368 %<latexrelease|fltrace>  \@tryfcolumn \@dbldeferlist
2369 %<latexrelease|fltrace>  \if@fcolmade
2370 %<*trace>
2371 %<latexrelease|fltrace>    \fl@trace{PAGE: double float page completed}%
2372 %</trace>
2373 %<latexrelease|fltrace>  \else
2374 %    \end{macrocode}
2375 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
2376 %    \begin{macrocode}
2377 %<latexrelease|fltrace>    \begingroup
2378 %<latexrelease|fltrace>      \let \reserved@b \@dbldeferlist
2379 %<latexrelease|fltrace>      \global \let \@dbldeferlist \@empty
2380 %<latexrelease|fltrace>      \let \@elt \@sdblcolelt
2381 %<latexrelease|fltrace>      \reserved@b
2382 %<latexrelease|fltrace>    \endgroup
2383 %<latexrelease|fltrace>  \fi
2384 %<latexrelease|fltrace>}%
2385 %<latexrelease|fltrace>\EndIncludeInRelease
2386 %<*2ekernel|fltrace>
2387 %    \end{macrocode}
2388 %  \end{macro}
2389 %  \end{macro}
2391 %  \begin{macro}{\@tryfcolumn}
2392 % \changes{v1.0f}{1993/12/05}{Command changed}
2393 %    Now tests if its list is empty before any further exertion.
2395 %    \begin{macrocode}
2396 \def \@tryfcolumn #1{%
2397   \global \@fcolmadefalse
2398   \ifx #1\@empty
2399   \else
2400 %<*trace>
2401      \fl@trace{PAGE: try float \if@twocolumn column/page\else page\fi
2402                   ---\string #1}%
2403      \fl@trace{----- \string #1: #1}%
2404 %</trace>
2405 %    \end{macrocode}
2406 % \changes{v1.0h}{1993/12/12}{defs changed to lets}
2407 %    \begin{macrocode}
2408     \xdef\@trylist{#1}%
2409     \global \let \@failedlist \@empty
2410     \begingroup
2411       \let \@elt \@xtryfc \@trylist
2412     \endgroup
2413     \if@fcolmade
2414       \@vtryfc #1%
2415     \fi
2416   \fi
2418 %</2ekernel|fltrace>
2419 %    \end{macrocode}
2421 %  \end{macro}
2423 %    \begin{macrocode}
2424 %<*2ekernel>
2425 %    \end{macrocode}
2427 % \begin{macro}{\@scolelt}
2428 %    \begin{macrocode}
2429 \def\@scolelt#1{\def\@currbox{#1}\@addtonextcol}
2430 %    \end{macrocode}
2431 % \end{macro}
2433 % \begin{macro}{\@sdblcolelt}
2434 %    \begin{macrocode}
2435 \def\@sdblcolelt#1{\def\@currbox{#1}\@addtodblcol}
2436 %    \end{macrocode}
2437 % \end{macro}
2439 % \begin{macro}{\@vtryfc}
2440 % \changes{v1.2d}{1997/11/19}{Reindent code, to be understandable(DPC).}
2441 %    \begin{macrocode}
2442 \def\@vtryfc #1{%
2443   \global\setbox\@outputbox\vbox{}%
2444   \let\@elt\@wtryfc
2445   \@flsucceed
2446   \global\setbox\@outputbox \vbox to\@colht{%
2447     \vskip \@fptop
2448     \vskip -\@fpsep
2449     \unvbox \@outputbox
2450     \vskip \@fpbot}%
2451   \let\@elt\relax
2452   \xdef #1{\@failedlist\@flfail}%
2453   \xdef\@freelist{\@freelist\@flsucceed}}
2454 %    \end{macrocode}
2455 % \end{macro}
2457 % \begin{macro}{\@wtryfc}
2458 %    \begin{macrocode}
2459 \def\@wtryfc #1{%
2460   \global\setbox\@outputbox\vbox{%
2461     \unvbox\@outputbox
2462     \vskip\@fpsep
2463     \box #1}}
2464 %    \end{macrocode}
2465 % \end{macro}
2467 % \begin{macro}{\@xtryfc}
2468 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
2469 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
2470 %    \begin{macrocode}
2471 %</2ekernel>
2472 %<latexrelease>\IncludeInRelease{2015/01/01}{\@xtryfc}%
2473 %<latexrelease>                             {float order in 2-column}%
2474 %<*2ekernel|latexrelease>
2475 \def\@xtryfc #1{%
2476   \@next\reserved@a\@trylist{}{}%
2477   \@currtype \count #1%
2478   \divide\@currtype\@xxxii
2479   \multiply\@currtype\@xxxii
2480   \@bitor \@currtype \@failedlist
2481   \@testfp #1%
2482 %    \end{macrocode}
2484 %    \begin{macrocode}
2485   \@testwrongwidth #1%
2486 %    \end{macrocode}
2488 %    \begin{macrocode}
2489   \ifdim \ht #1>\@colht
2490      \@testtrue
2491   \fi
2492   \if@test
2493     \@cons\@failedlist #1%
2494   \else
2495     \@ytryfc #1%
2496   \fi}%
2497 %</2ekernel|latexrelease>
2498 %<latexrelease>\EndIncludeInRelease
2499 %<latexrelease>\IncludeInRelease{0000/00/00}{\@xtryfc}%
2500 %<latexrelease>                             {float order in 2-column}%
2501 %<latexrelease>\def\@xtryfc #1{%
2502 %<latexrelease>  \@next\reserved@a\@trylist{}{}%
2503 %<latexrelease>  \@currtype \count #1%
2504 %<latexrelease>  \divide\@currtype\@xxxii
2505 %<latexrelease>  \multiply\@currtype\@xxxii
2506 %<latexrelease>  \@bitor \@currtype \@failedlist
2507 %<latexrelease>  \@testfp #1%
2508 %<latexrelease>  \ifdim \ht #1>\@colht
2509 %<latexrelease>    \@testtrue
2510 %<latexrelease>  \fi
2511 %<latexrelease>  \if@test
2512 %<latexrelease>    \@cons\@failedlist #1%
2513 %<latexrelease>  \else
2514 %<latexrelease>    \@ytryfc #1%
2515 %<latexrelease>  \fi}%
2516 %<latexrelease>\EndIncludeInRelease
2517 %<*2ekernel>
2518 %    \end{macrocode}
2519 % \end{macro}
2521 % \begin{macro}{\@ytryfc}
2522 %    \begin{macrocode}
2523 \def\@ytryfc #1{%
2524   \begingroup
2525     \gdef\@flsucceed{\@elt #1}%
2526     \global\let\@flfail\@empty
2527     \@tempdima\ht #1%
2528     \let\@elt\@ztryfc
2529     \@trylist
2530     \ifdim \@tempdima >\@fpmin
2531       \global\@fcolmadetrue
2532     \else
2533       \@cons\@failedlist #1%
2534     \fi
2535   \endgroup
2536   \if@fcolmade
2537     \let\@elt\@gobble
2538   \fi}
2539 %    \end{macrocode}
2540 % \end{macro}
2542 % \begin{macro}{\@ztryfc}
2543 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
2544 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
2545 %    \begin{macrocode}
2546 %</2ekernel>
2547 %<latexrelease>\IncludeInRelease{2015/01/01}{@ztryfc}%
2548 %<latexrelease>                             {float order in 2-column}%
2549 %<*2ekernel|latexrelease>
2550 \def\@ztryfc #1{%
2551   \@tempcnta\count #1%
2552   \divide\@tempcnta\@xxxii
2553   \multiply\@tempcnta\@xxxii
2554   \@bitor \@tempcnta {\@failedlist \@flfail}%
2555   \@testfp #1%
2556 %    \end{macrocode}
2558 % not in fixfloats?
2559 %    \begin{macrocode}
2560   \@testwrongwidth #1%
2561 %    \end{macrocode}
2563 %    \begin{macrocode}
2564   \@tempdimb\@tempdima
2565   \advance\@tempdimb\ht #1%
2566   \advance\@tempdimb\@fpsep
2567   \ifdim \@tempdimb >\@colht
2568     \@testtrue
2569   \fi
2570   \if@test
2571     \@cons\@flfail #1%
2572   \else
2573     \@cons\@flsucceed #1%
2574     \@tempdima\@tempdimb
2575   \fi}%
2576 %</2ekernel|latexrelease>
2577 %<latexrelease>\EndIncludeInRelease
2578 %<latexrelease>\IncludeInRelease{0000/00/00}{@ztryfc}%
2579 %<latexrelease>                             {float order in 2-column}%
2580 %<latexrelease>\def\@ztryfc #1{%
2581 %<latexrelease>  \@tempcnta \count#1%
2582 %<latexrelease>  \divide\@tempcnta\@xxxii
2583 %<latexrelease>  \multiply\@tempcnta\@xxxii
2584 %<latexrelease>  \@bitor \@tempcnta {\@failedlist \@flfail}%
2585 %<latexrelease>  \@testfp #1%
2586 %<latexrelease>  \@tempdimb\@tempdima
2587 %<latexrelease>  \advance\@tempdimb \ht#1%
2588 %<latexrelease>  \advance\@tempdimb\@fpsep
2589 %<latexrelease>  \ifdim \@tempdimb >\@colht
2590 %<latexrelease>    \@testtrue
2591 %<latexrelease>  \fi
2592 %<latexrelease>  \if@test
2593 %<latexrelease>    \@cons\@flfail #1%
2594 %<latexrelease>  \else
2595 %<latexrelease>    \@cons\@flsucceed #1%
2596 %<latexrelease>    \@tempdima\@tempdimb
2597 %<latexrelease>  \fi}%
2598 %<latexrelease>\EndIncludeInRelease
2599 %    \end{macrocode}
2600 % \end{macro}
2603 % The major changes for float suppression and the changes to the float
2604 % mechanism to make it conform to the documentation are in these next
2605 % macros.
2607 %  \begin{macro}{\@addtobot}
2608 % \changes{v1.0f}{1993/12/05}{Command changed}
2609 %    Lots of changes.
2611 %    \begin{macrocode}
2612 %<*2ekernel|fltrace>
2613 \def \@addtobot {%
2614 %<*trace>
2615    \fl@trace{***Start addtobot}%
2616 %</trace>
2617    \@getfpsbit 4\relax
2618 %<*trace>
2619    \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi bot:
2620                                                      \the \@fpstype}%
2621 %</trace>
2622    \ifodd \@tempcnta
2623      \@flsetnum \@botnum
2624      \ifnum \@botnum>\z@
2625        \@tempswafalse
2626        \@flcheckspace \@botroom \@botlist
2627        \if@tempswa
2628 %    \end{macrocode}
2629 %    This next line means that this page is produced with box 255
2630 %    having depth zero, rather than the normal maxdepth: is this
2631 %    needed, useful?
2632 % \task{CAR/FMi}{Investigate resetting of maxdepth: I do not think it is
2633 % necessary here; Frank does.}
2634 %    \begin{macrocode}
2635          \global \maxdepth \z@
2636          \@flupdates \@botnum \@botroom \@botlist
2637 %<*trace>
2638          \fl@trace{colroom (after-bot) = \the \@colroom}%
2639          \fl@trace{colnum (after-bot) = \the \@colnum}%
2640          \fl@trace{botnum (after-bot) = \the \@botnum}%
2641          \fl@trace{***Success: bot}%
2642 %</trace>
2643          \@inserttrue
2644        \fi
2645 %<*trace>
2646      \else
2647        \fl@trace{Fail: botnum = \the \@botnum:
2648                                   fpstype \the \@fpstype=ORD?}%
2649        \ifnum \@fpstype<\sixt@@n
2650          \fl@trace{ERROR: !b float not successful (addtobot)}%
2651        \fi
2652 %</trace>
2653      \fi
2654    \fi
2656 %    \end{macrocode}
2657 %  \end{macro}
2659 %  \begin{macro}{\@addtotoporbot}
2660 % \changes{v1.0f}{1993/12/05}{Command changed}
2661 %    Lots of changes.
2663 %    \begin{macrocode}
2664 \def \@addtotoporbot {%
2665 %<*trace>
2666    \fl@trace{***Start addtotoporbot}%
2667 %</trace>
2668    \@getfpsbit \tw@
2669 %<*trace>
2670    \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi top:
2671                                                      \the \@fpstype}%
2672 %</trace>
2673    \ifodd \@tempcnta
2674      \@flsetnum \@topnum
2675      \ifnum \@topnum>\z@
2676        \@tempswafalse
2677        \@flcheckspace \@toproom \@toplist
2678        \if@tempswa
2679          \@bitor\@currtype{\@midlist\@botlist}%
2680 %<*trace>
2681            \fl@trace{(mid+bot)list: \@midlist, \@botlist:
2682                               (addtotoporbot-before)}%
2683 %</trace>
2684          \if@test
2685 %<*trace>
2686          \fl@trace{type already on list: mid or bot---sent to addtobot}%
2687 %</trace>
2688          \else
2689           \@flupdates \@topnum \@toproom \@toplist
2690 %<*trace>
2691           \fl@trace{colroom (after-top) = \the \@colroom}%
2692           \fl@trace{colnum (after-top) = \the \@colnum}%
2693           \fl@trace{topnum (after-top) = \the \@topnum}%
2694           \fl@trace{***Success: top}%
2695 %</trace>
2696           \@inserttrue
2697          \fi
2698        \fi
2699 %<*trace>
2700      \else
2701        \fl@trace{Fail: topnum = \the \@topnum: fpstype
2702                                             \the \@fpstype=ORD?}%
2703        \ifnum \@fpstype<\sixt@@n
2704          \fl@trace{ERROR: !t float not successful (addtotoporbot)}%
2705        \fi
2706 %</trace>
2707      \fi
2708    \fi
2709    \if@insert
2710    \else
2711 %<*trace>
2712      \fl@trace{sent to addtobot (addtotoporbot)}%
2713 %</trace>
2714      \@addtobot
2715    \fi
2717 %</2ekernel|fltrace>
2718 %    \end{macrocode}
2719 %  \end{macro}
2721 %  \begin{macro}{\@addtocurcol}
2722 % \changes{v1.0f}{1993/12/05}{Command changed}
2723 % \task{CAR}{Add rules around h floats for FMi}
2724 % \task{CAR}{Investigate pagebreak option possibilities}
2725 %    Lots of changes.
2727 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
2728 %    \begin{macrocode}
2729 %<latexrelease|fltrace|flafter>\IncludeInRelease{2015/01/01}%
2730 %<latexrelease|fltrace|flafter>  {\@addtocurcol}{float order in 2-column}%
2731 %<*2ekernel|latexrelease|fltrace|flafter>
2732 \def \@addtocurcol {%
2733 %<*trace>
2734   \fl@trace{***Start addtocurcol}%
2735 %</trace>
2736    \@insertfalse
2737    \@setfloattypecounts
2738    \ifnum \@fpstype=8
2739 %<*trace>
2740      \fl@trace{fpstype !p only (addtocurcol): \the \@fpstype = 8?}%
2741 %</trace>
2742    \else
2743      \ifnum \@fpstype=24
2744 %<*trace>
2745        \fl@trace{fpstype p only (addtocurcol): \the \@fpstype = 24?}%
2746 %</trace>
2747      \else
2748        \@flsettextmin
2749 %    \end{macrocode}
2750 % This is a new adjustment which is quite a major change in
2751 % functionality; but it implements the documentation.
2752 % Note that |\@reqcolroom| will include the whole of the
2753 % page-so-far, and hence includes |\@textfloatsheight| of floats,
2754 % so before comparing it with |\@textmin|, we add this to
2755 % |\@textmin| also.
2756 %    \begin{macrocode}
2757 %<*trace>
2758        \fl@trace{textfloatsheight (before) = \the \@textfloatsheight}%
2759 %</trace>
2760        \advance \@textmin \@textfloatsheight
2761        \@reqcolroom \@pageht
2762 %    \end{macrocode}
2763 % This line must be removed since |\@specialoutput| changed.
2764 %    \begin{macrocode}
2765 %       \advance \@reqcolroom \@pagedp
2766 %<*trace>
2767        \fl@trace{textmin + textfloatsheight: \the \@textmin}%
2768        \fl@trace{page-so-far: \the \@reqcolroom}%
2769 %</trace>
2770        \ifdim \@textmin>\@reqcolroom
2771          \@reqcolroom \@textmin
2772 %<*trace>
2773          \fl@trace{ORD? textmin being used}%
2774 %</trace>
2775        \fi
2776        \advance \@reqcolroom \ht\@currbox
2777 %<*trace>
2778        \fl@trace{float size = \the \ht \@currbox (addtocurcol)}%
2779        \fl@trace{colroom = \the \@colroom (addtocurcol)}%
2780        \fl@trace{reqcolroom = \the \@reqcolroom (addtocurcol)}%
2781 %</trace>
2782        \ifdim \@colroom>\@reqcolroom
2783          \@flsetnum \@colnum
2784          \ifnum \@colnum>\z@
2785            \@bitor\@currtype\@deferlist
2786 %    \end{macrocode}
2787 %    We need to defer the float also if its width
2788 %    doesn't fit.
2789 % \changes{v1.2n}{2000/09/24}{FMi: test for wide float was
2790 %    in wrong place}
2791 %    \begin{macrocode}
2792           \@testwrongwidth\@currbox
2793 %    \end{macrocode}
2795 %    \begin{macrocode}
2796 %<*trace>
2797            \fl@trace{deferlist: \@deferlist: (addtocurcol-before)}%
2798 %</trace>
2799            \if@test
2800 %<*trace>
2801              \fl@trace{type already on list: defer (addtocurcol)}%
2802 %</trace>
2803            \else
2804              \@bitor\@currtype\@botlist
2805 %<*trace>
2806            \fl@trace{botlist: \@botlist: (addtocurcol-before)}%
2807 %</trace>
2808              \if@test
2809 %<*trace>
2810                \fl@trace{type already on list: bot---sent to addtobot}%
2811 %</trace>
2812                \@addtobot
2813              \else
2814 %<*trace>
2815                \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi
2816                       here: \the \@fpstype}%
2817 %</trace>
2818                \ifodd \count\@currbox
2819                  \advance \@reqcolroom \intextsep
2820                  \ifdim \@colroom>\@reqcolroom
2821                    \global \advance \@colnum \m@ne
2822                    \global \advance \@textfloatsheight \ht\@currbox
2823 %    \end{macrocode}
2824 % This may sometimes give an overestimate.
2825 %    \begin{macrocode}
2826                    \global \advance \@textfloatsheight 2\intextsep
2827                    \@cons \@midlist \@currbox
2828 %<*trace>
2829                  \fl@trace{***Success: here}%
2830                  \fl@trace{textfloatsheight (after-here) =
2831                       \the \@textfloatsheight}%
2832                  \fl@trace{colnum (after-here) = \the \@colnum}%
2833 %</trace>
2834 %    \end{macrocode}
2836 % CHANGE TO |\@addtocurcol|:
2838 % |\penalty\z@| changed to |\penalty\interlinepenalty| so |\samepage|
2839 % works properly with figure and table environments.
2840 % (Changed 23 Oct 86)
2842 % There is also an |\addpenalty\interlinepenalty| above.
2844 % Since in 2e |\samepage| is no longer supported, these could be
2845 % removed.
2847 % Although it is best to use |\addvspace| in case two h floats come
2848 % together, this makes other spacing more difficult to adjust; whereas
2849 % if a user specifies two h floats together then they can more easily
2850 % get the spacing correct by ad hoc commands.
2852 % It is necessary to adjust for the addition of |\parskip| here in
2853 % case the float is added between paragraphs (\ie when in vertical
2854 % mode).
2856 % If the nobreak switch is true we need to reset it and clear
2857 % |\everypar| since the float may not reset the flag and cannot reset
2858 % the |\everypar| globally.
2859 % \changes{v1.0l}{1994/03/15}{Changed \cs{addvspace} to \cs{vskip}}
2860 % \changes{v1.1i}{1994/11/21}
2861 %   {Added \cs{if@nobreak} test before float box}
2862 % \changes{v1.1z}{1996/10/24}{Added \cs{nobreak}, etc as appropriate}
2864 % Typesetting starts here (we are in vertical mode).
2865 %    \begin{macrocode}
2866                    \if@nobreak
2867                      \nobreak
2868                      \@nobreakfalse
2869                      \everypar{}%
2870                    \else
2871                      \addpenalty \interlinepenalty
2872                    \fi
2873                    \vskip \intextsep
2874                    \box\@currbox
2875                    \penalty\interlinepenalty
2876                    \vskip\intextsep
2877                    \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
2878 %    \end{macrocode}
2879 % Typesetting ends here.
2880 %    \begin{macrocode}
2881                    \outputpenalty \z@
2882                    \@inserttrue
2883 %<*trace>
2884                  \else
2885                    \fl@trace{Fail---no room at 2nd test of colroom
2886                                  (addtocorcol \string\intextsep)}%
2887 %</trace>
2888                  \fi
2889                \fi
2890                \if@insert
2891                \else
2892 %    \end{macrocode}
2893 %   Next set of docstrip guards are a bit weird, essentially
2894 %   |\@addtotoporbot| ends up inside the kernel and the
2895 %   \texttt{fltrace} package and |\@addtobot| shows up in the
2896 %   \texttt{flafter} package. Guess that could have been done a bit
2897 %   more obvious :-)
2898 %    \begin{macrocode}
2899 %<*2ekernel|fltrace|latexrelease>
2900 %<*trace>
2901                  \fl@trace{not here: sent to addtotoporbot}%
2902 %</trace>
2903                  \@addtotoporbot
2904 %</2ekernel|fltrace|latexrelease>
2905 %<*!2ekernel&!fltrace&!latexrelease>
2906 %<*trace>
2907                  \fl@trace{not here: sent to addtobot}%
2908 %</trace>
2909                  \@addtobot
2910 %</!2ekernel&!fltrace&!latexrelease>
2911                \fi
2912              \fi
2913            \fi
2914 %<*trace>
2915          \else
2916            \fl@trace{Fail: colnum = \the \@colnum:
2917                         fpstype \the \@fpstype=ORD?}%
2918            \ifnum \@fpstype<\sixt@@n
2919              \fl@trace{ERROR: BANG float not successful (addtocurcol)}%
2920            \fi
2921 %</trace>
2922          \fi
2923 %<*trace>
2924        \else
2925          \fl@trace{Fail---no room: fl box ht: \the \ht \@currbox
2926                                                      (addtocurcol)}%
2927 %</trace>
2928        \fi
2929      \fi
2930    \fi
2931    \if@insert
2932    \else
2933      \@resethfps
2934 %<*trace>
2935      \fl@trace{put on deferlist (addtocurcol)}%
2936 %</trace>
2937      \@cons\@deferlist\@currbox
2938 %<*trace>
2939      \fl@trace{deferlist: \@deferlist: (addtocurcol-after)}%
2940 %</trace>
2941    \fi
2943 %</2ekernel|latexrelease|fltrace|flafter>
2944 %<latexrelease|fltrace|flafter>\EndIncludeInRelease
2945 %<latexrelease|fltrace|flafter>\IncludeInRelease{0000/00/00}%
2946 %<latexrelease|fltrace|flafter>  {\@addtocurcol}{float order in 2-column}%
2947 %<latexrelease|fltrace|flafter>\def \@addtocurcol {%
2948 %<*trace>
2949 %<latexrelease|fltrace|flafter>  \fl@trace{***Start addtocurcol}%
2950 %</trace>
2951 %<latexrelease|fltrace|flafter>   \@insertfalse
2952 %<latexrelease|fltrace|flafter>   \@setfloattypecounts
2953 %<latexrelease|fltrace|flafter>   \ifnum \@fpstype=8
2954 %<*trace>
2955 %<latexrelease|fltrace|flafter>     \fl@trace{fpstype !p only (addtocurcol):
2956 %<latexrelease|fltrace|flafter>                            \the \@fpstype = 8?}%
2957 %</trace>
2958 %<latexrelease|fltrace|flafter>   \else
2959 %<latexrelease|fltrace|flafter>     \ifnum \@fpstype=24
2960 %<*trace>
2961 %<latexrelease|fltrace|flafter>      \fl@trace{fpstype p only (addtocurcol):
2962 %<latexrelease|fltrace|flafter>                           \the \@fpstype = 24?}%
2963 %</trace>
2964 %<latexrelease|fltrace|flafter>     \else
2965 %<latexrelease|fltrace|flafter>       \@flsettextmin
2966 %    \end{macrocode}
2967 % This is a new adjustment which is quite a major change in
2968 % functionality; but it implements the documentation.
2969 % Note that |\@reqcolroom| will include the whole of the
2970 % page-so-far, and hence includes |\@textfloatsheight| of floats,
2971 % so before comparing it with |\@textmin|, we add this to
2972 % |\@textmin| also.
2973 %    \begin{macrocode}
2974 %<*trace>
2975 %<latexrelease|fltrace|flafter>       \fl@trace{textfloatsheight (before) = 
2976 %<latexrelease|fltrace|flafter>                        \the \@textfloatsheight}%
2977 %</trace>
2978 %<latexrelease|fltrace|flafter>       \advance \@textmin \@textfloatsheight
2979 %<latexrelease|fltrace|flafter>       \@reqcolroom \@pageht
2980 %    \end{macrocode}
2981 % This line must be removed since |\@specialoutput| changed.
2982 %    \begin{macrocode}
2983 %       \advance \@reqcolroom \@pagedp
2984 %<*trace>
2985 %<latexrelease|fltrace|flafter>       \fl@trace{textmin + textfloatsheight:
2986 %<latexrelease|fltrace|flafter>                                 \the \@textmin}%
2987 %<latexrelease|fltrace|flafter>       \fl@trace{page-so-far: \the \@reqcolroom}%
2988 %<latexrelease|fltrace|flafter>
2989 %</trace>
2990 %<latexrelease|fltrace|flafter>       \ifdim \@textmin>\@reqcolroom
2991 %<latexrelease|fltrace|flafter>         \@reqcolroom \@textmin
2992 %<*trace>
2993 %<latexrelease|fltrace|flafter>         \fl@trace{ORD? textmin being used}%
2994 %</trace>
2995 %<latexrelease|fltrace|flafter>       \fi
2996 %<latexrelease|fltrace|flafter>       \advance \@reqcolroom \ht\@currbox
2997 %<*trace>
2998 %<latexrelease|fltrace|flafter>       \fl@trace{float size = 
2999 %<latexrelease|fltrace|flafter>               \the \ht \@currbox (addtocurcol)}%
3000 %<latexrelease|fltrace|flafter>       \fl@trace{colroom =
3001 %<latexrelease|fltrace|flafter>                   \the \@colroom (addtocurcol)}%
3002 %<latexrelease|fltrace|flafter>       \fl@trace{reqcolroom =
3003 %<latexrelease|fltrace|flafter>                \the \@reqcolroom (addtocurcol)}%
3004 %</trace>
3005 %<latexrelease|fltrace|flafter>       \ifdim \@colroom>\@reqcolroom
3006 %<latexrelease|fltrace|flafter>         \@flsetnum \@colnum
3007 %<latexrelease|fltrace|flafter>         \ifnum \@colnum>\z@
3008 %<latexrelease|fltrace|flafter>           \@bitor\@currtype\@deferlist
3009 %<*trace>
3010 %<latexrelease|fltrace|flafter>           \fl@trace{deferlist:
3011 %<latexrelease|fltrace|flafter>              \@deferlist: (addtocurcol-before)}%
3012 %</trace>
3013 %<latexrelease|fltrace|flafter>           \if@test
3014 %<*trace>
3015 %<latexrelease|fltrace|flafter>             \fl@trace{type already on list:
3016 %<latexrelease|fltrace|flafter>                            defer (addtocurcol)}%
3017 %</trace>
3018 %<latexrelease|fltrace|flafter>           \else
3019 %<latexrelease|fltrace|flafter>             \@bitor\@currtype\@botlist
3020 %<*trace>
3021 %<latexrelease|fltrace|flafter>           \fl@trace{botlist: \@botlist:
3022 %<latexrelease|fltrace|flafter>                           (addtocurcol-before)}%
3023 %</trace>
3024 %<latexrelease|fltrace|flafter>             \if@test
3025 %<*trace>
3026 %<latexrelease|fltrace|flafter>               \fl@trace{type already on list:
3027 %<latexrelease|fltrace|flafter>                         bot---sent to addtobot}%
3028 %</trace>
3029 %<latexrelease|fltrace|flafter>               \@addtobot
3030 %<latexrelease|fltrace|flafter>             \else
3031 %<*trace>
3032 %<latexrelease|fltrace|flafter>               \fl@trace{fpstype
3033 %<latexrelease|fltrace|flafter>               \ifodd \@tempcnta OK \else not \fi
3034 %<latexrelease|fltrace|flafter>               here: \the \@fpstype}%
3035 %</trace>
3036 %<latexrelease|fltrace|flafter>               \ifodd \count\@currbox
3037 %<latexrelease|fltrace|flafter>                 \advance \@reqcolroom \intextsep
3038 %<latexrelease|fltrace|flafter>                 \ifdim \@colroom>\@reqcolroom
3039 %<latexrelease|fltrace|flafter>                  \global \advance \@colnum \m@ne
3040 %<latexrelease|fltrace|flafter>                  \global \advance
3041 %<latexrelease|fltrace|flafter>                   \@textfloatsheight\ht\@currbox
3042 %    \end{macrocode}
3043 % This may sometimes give an overestimate.
3044 %    \begin{macrocode}
3045 %<latexrelease|fltrace|flafter>                  \global \advance
3046 %<latexrelease|fltrace|flafter>                   \@textfloatsheight 2\intextsep
3047 %<latexrelease|fltrace|flafter>                   \@cons \@midlist \@currbox
3048 %<*trace>
3049 %<latexrelease|fltrace|flafter>                 \fl@trace{***Success: here}%
3050 %<latexrelease|fltrace|flafter>                 \fl@trace{textfloatsheight
3051 %<latexrelease|fltrace|flafter>                      (after-here) =
3052 %<latexrelease|fltrace|flafter>                      \the \@textfloatsheight}%
3053 %<latexrelease|fltrace|flafter>                 \fl@trace{colnum (after-here) =
3054 %<latexrelease|fltrace|flafter>                          \the \@colnum}%
3055 %</trace>
3056 %    \end{macrocode}
3058 % CHANGE TO |\@addtocurcol|:
3060 % |\penalty\z@| changed to |\penalty\interlinepenalty| so |\samepage|
3061 % works properly with figure and table environments.
3062 % (Changed 23 Oct 86)
3064 % There is also an |\addpenalty\interlinepenalty| above.
3066 % Since in 2e |\samepage| is no longer supported, these could be
3067 % removed.
3069 % Although it is best to use |\addvspace| in case two h floats come
3070 % together, this makes other spacing more difficult to adjust; whereas
3071 % if a user specifies two h floats together then they can more easily
3072 % get the spacing correct by ad hoc commands.
3074 % It is necessary to adjust for the addition of |\parskip| here in
3075 % case the float is added between paragraphs (\ie when in vertical
3076 % mode).
3078 % If the nobreak switch is true we need to reset it and clear
3079 % |\everypar| since the float may not reset the flag and cannot reset
3080 % the |\everypar| globally.
3081 % \changes{v1.0l}{1994/03/15}{Changed \cs{addvspace} to \cs{vskip}}
3082 % \changes{v1.1i}{1994/11/21}
3083 %   {Added \cs{if@nobreak} test before float box}
3084 % \changes{v1.1z}{1996/10/24}{Added \cs{nobreak}, etc as appropriate}
3086 % Typesetting starts here (we are in vertical mode).
3087 %    \begin{macrocode}
3088 %<latexrelease|fltrace|flafter>                   \if@nobreak
3089 %<latexrelease|fltrace|flafter>                     \nobreak
3090 %<latexrelease|fltrace|flafter>                     \@nobreakfalse
3091 %<latexrelease|fltrace|flafter>                     \everypar{}%
3092 %<latexrelease|fltrace|flafter>                   \else
3093 %<latexrelease|fltrace|flafter>                     \addpenalty\interlinepenalty
3094 %<latexrelease|fltrace|flafter>                   \fi
3095 %<latexrelease|fltrace|flafter>                   \vskip \intextsep
3096 %<latexrelease|fltrace|flafter>                   \box\@currbox
3097 %<latexrelease|fltrace|flafter>                   \penalty\interlinepenalty
3098 %<latexrelease|fltrace|flafter>                   \vskip\intextsep
3099 %<latexrelease|fltrace|flafter>                   \ifnum\outputpenalty 
3100 %<latexrelease|fltrace|flafter>                               <-\@Mii \vskip
3101 %<latexrelease|fltrace|flafter>                        -\parskip\fi
3102 %    \end{macrocode}
3103 % Typesetting ends here.
3104 %    \begin{macrocode}
3105 %<latexrelease|fltrace|flafter>                   \outputpenalty \z@
3106 %<latexrelease|fltrace|flafter>                   \@inserttrue
3107 %<*trace>
3108 %<latexrelease|fltrace|flafter>                 \else
3109 %<latexrelease|fltrace|flafter>  \fl@trace{Fail---no room at 2nd test of colroom
3110 %<latexrelease|fltrace|flafter>                (addtocorcol \string\intextsep)}%
3111 %</trace>
3112 %<latexrelease|fltrace|flafter>                 \fi
3113 %<latexrelease|fltrace|flafter>               \fi
3114 %<latexrelease|fltrace|flafter>               \if@insert
3115 %<latexrelease|fltrace|flafter>               \else
3116 %    \end{macrocode}
3117 %   Next set of docstrip guards are a bit weird, essentially
3118 %   |\@addtotoporbot| ends up inside the kernel and the
3119 %   \texttt{fltrace} package and |\@addtotoporbot| shows up in the
3120 %   \texttt{flafter} package. Guess that could have been done a bit
3121 %   more obvious :-)
3122 %    \begin{macrocode}
3123 %<*2ekernel|fltrace>
3124 %<*trace>
3125 %<latexrelease|fltrace|flafter>      \fl@trace{not here: sent to addtotoporbot}%
3126 %</trace>
3127 %<latexrelease|fltrace|flafter>                 \@addtotoporbot
3128 %</2ekernel|fltrace>
3129 %<*!2ekernel&!autoload&!fltrace>
3130 %<*trace>
3131 %<latexrelease|fltrace|flafter>       \fl@trace{not here: sent to addtobot}%
3132 %</trace>
3133 %<latexrelease|fltrace|flafter>                 \@addtobot
3134 %</!2ekernel&!autoload&!fltrace>
3135 %<latexrelease|fltrace|flafter>               \fi
3136 %<latexrelease|fltrace|flafter>             \fi
3137 %<latexrelease|fltrace|flafter>           \fi
3138 %<*trace>
3139 %<latexrelease|fltrace|flafter>         \else
3140 %<latexrelease|fltrace|flafter>         \fl@trace{Fail: colnum = \the \@colnum:
3141 %<latexrelease|fltrace|flafter>                    fpstype \the \@fpstype=ORD?}%
3142 %<latexrelease|fltrace|flafter>         \ifnum \@fpstype<\sixt@@n
3143 %<latexrelease|fltrace|flafter>  \fl@trace{ERROR: BANG float not successful 
3144 %<latexrelease|fltrace|flafter>                                  (addtocurcol)}%
3145 %<latexrelease|fltrace|flafter>           \fi
3146 %</trace>
3147 %<latexrelease|fltrace|flafter>         \fi
3148 %<*trace>
3149 %<latexrelease|fltrace|flafter>       \else
3150 %<latexrelease|fltrace|flafter>         \fl@trace{Fail---no room: fl box ht: 
3151 %<latexrelease|fltrace|flafter>               \the \ht \@currbox (addtocurcol)}%
3152 %</trace>
3153 %<latexrelease|fltrace|flafter>       \fi
3154 %<latexrelease|fltrace|flafter>     \fi
3155 %<latexrelease|fltrace|flafter>   \fi
3156 %<latexrelease|fltrace|flafter>   \if@insert
3157 %<latexrelease|fltrace|flafter>   \else
3158 %<latexrelease|fltrace|flafter>     \@resethfps
3159 %<*trace>
3160 %<latexrelease|fltrace|flafter>     \fl@trace{put on deferlist (addtocurcol)}%
3161 %</trace>
3162 %<latexrelease|fltrace|flafter>     \@cons\@deferlist\@currbox
3163 %<*trace>
3164 %<latexrelease|fltrace|flafter>     \fl@trace{deferlist: \@deferlist:
3165 %<latexrelease|fltrace|flafter>                          (addtocurcol-after)}%
3166 %</trace>
3167 %<latexrelease|fltrace|flafter>   \fi
3168 %<latexrelease|fltrace|flafter>  }%
3169 %<latexrelease|fltrace|flafter>\EndIncludeInRelease
3170 %    \end{macrocode}
3171 %  \end{macro}
3173 %  \begin{macro}{\@addtonextcol}
3174 % \changes{v1.0f}{1993/12/05}{Command changed}
3175 %    Lots of changes.
3177 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
3178 %    \begin{macrocode}
3179 %<latexrelease|fltrace>\IncludeInRelease{2015/01/01}
3180 %<latexrelease|fltrace>  {\@addtonextcol}{float order in 2-column}%
3181 %<*2ekernel|fltrace>
3182 \def\@addtonextcol{%
3183   \begingroup
3184 %<*trace>
3185    \fl@trace{***Start addtonextcol}%
3186 %</trace>
3187    \@insertfalse
3188    \@setfloattypecounts
3189    \ifnum \@fpstype=8
3190 %<*trace>
3191      \fl@trace{fpstype not curcol: \the \@fpstype = 8?}%
3192 %</trace>
3193    \else
3194      \ifnum \@fpstype=24
3195 %<*trace>
3196        \fl@trace{fpstype not curcol: \the \@fpstype = 24?}%
3197 %</trace>
3198      \else
3199        \@flsettextmin
3200 %<*trace>
3201        \fl@trace{text-so-far: 0pt (top of col)}%
3202 %</trace>
3203        \@reqcolroom \ht\@currbox
3204 %<*trace>
3205        \fl@trace{float size: \the \@reqcolroom (addtonextcol)}%
3206 %</trace>
3207        \advance \@reqcolroom \@textmin
3208 %<*trace>
3209        \fl@trace{colroom = \the \@colroom (addtonextcol)}%
3210        \fl@trace{reqcolroom = \the \@reqcolroom (addtonextcol)}%
3211 %</trace>
3212        \ifdim \@colroom>\@reqcolroom
3213          \@flsetnum \@colnum
3214          \ifnum\@colnum>\z@
3215             \@bitor\@currtype\@deferlist
3216 %<*trace>
3217             \fl@trace{deferlist: \@deferlist: (addtonextcol-before)}%
3218 %</trace>
3219 %    \end{macrocode}
3221 %    \begin{macrocode}
3222             \@testwrongwidth\@currbox
3223 %    \end{macrocode}
3225 %    \begin{macrocode}
3226             \if@test
3227 %<*trace>
3228               \fl@trace{type already on list: defer (addtonextcol)}%
3229 %</trace>
3230             \else
3231 %<*trace>
3232               \fl@trace{sent to addtotoporbot (addtonextcol)}%
3233 %</trace>
3234               \@addtotoporbot
3235             \fi
3236          \fi
3237 %<*trace>
3238        \else
3239          \fl@trace{Fail---no room: fl box ht: \the \ht \@currbox
3240                                                   (addtonextcol)}%
3241 %</trace>
3242        \fi
3243      \fi
3244    \fi
3245    \if@insert
3246    \else
3247 %<*trace>
3248      \fl@trace{put back on deferlist (addtonextcol)}%
3249 %</trace>
3250      \@cons\@deferlist\@currbox
3251 %<*trace>
3252      \fl@trace{deferlist: \@deferlist: (addtonextcol-after)}%
3253 %</trace>
3254    \fi
3255 %<*trace>
3256   \fl@trace{End of addtonextcol -- locally counts:}%
3257   \fl@trace{col: \the\@colnum. top: \the \@topnum. bot: \the \@botnum.}%
3258 %</trace>
3259   \endgroup
3260 %<*trace>
3261  \fl@trace{End of addtonextcol -- globally counts:}%
3262  \fl@trace{col: \the\@colnum. top: \the \@topnum. bot: \the \@botnum.}%
3263 %</trace>
3265 %</2ekernel|fltrace>
3266 %<latexrelease|fltrace>\EndIncludeInRelease
3267 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
3268 %<latexrelease|fltrace>  {\@addtonextcol}{float order in 2-column}%
3269 %<latexrelease|fltrace>\def\@addtonextcol{%
3270 %<latexrelease|fltrace>  \begingroup
3271 %<*trace>
3272 %<latexrelease|fltrace>   \fl@trace{***Start addtonextcol}%
3273 %</trace>
3274 %<latexrelease|fltrace>   \@insertfalse
3275 %<latexrelease|fltrace>   \@setfloattypecounts
3276 %<latexrelease|fltrace>   \ifnum \@fpstype=8
3277 %<*trace>
3278 %<latexrelease|fltrace>     \fl@trace{fpstype not curcol:
3279 %<latexrelease|fltrace>                    \the \@fpstype = 8?}%
3280 %</trace>
3281 %<latexrelease|fltrace>   \else
3282 %<latexrelease|fltrace>     \ifnum \@fpstype=24
3283 %<*trace>
3284 %<latexrelease|fltrace>       \fl@trace{fpstype not curcol:
3285 %<latexrelease|fltrace>                       \the \@fpstype = 24?}%
3286 %</trace>
3287 %<latexrelease|fltrace>     \else
3288 %<latexrelease|fltrace>       \@flsettextmin
3289 %<*trace>
3290 %<latexrelease|fltrace>       \fl@trace{text-so-far: 0pt (top of col)}%
3291 %</trace>
3292 %<latexrelease|fltrace>       \@reqcolroom \ht\@currbox
3293 %<*trace>
3294 %<latexrelease|fltrace>       \fl@trace{float size:
3295 %<latexrelease|fltrace>               \the \@reqcolroom (addtonextcol)}%
3296 %<latexrelease|fltrace>
3297 %</trace>
3298 %<latexrelease|fltrace>       \advance \@reqcolroom \@textmin
3299 %<*trace>
3300 %<latexrelease|fltrace>       \fl@trace{colroom =
3301 %<latexrelease|fltrace>                  \the \@colroom (addtonextcol)}%
3302 %<latexrelease|fltrace>       \fl@trace{reqcolroom =
3303 %<latexrelease|fltrace>               \the \@reqcolroom (addtonextcol)}%
3304 %</trace>
3305 %<latexrelease|fltrace>       \ifdim \@colroom>\@reqcolroom
3306 %<latexrelease|fltrace>         \@flsetnum \@colnum
3307 %<latexrelease|fltrace>         \ifnum\@colnum>\z@
3308 %<latexrelease|fltrace>            \@bitor\@currtype\@deferlist
3309 %<*trace>
3310 %<latexrelease|fltrace>            \fl@trace{deferlist: \@deferlist:
3311 %<latexrelease|fltrace>                          (addtonextcol-before)}%
3312 %</trace>
3313 %<latexrelease|fltrace>            \if@test
3314 %<*trace>
3315 %<latexrelease|fltrace>              \fl@trace{type already on list:
3316 %<latexrelease|fltrace>                           defer (addtonextcol)}%
3317 %</trace>
3318 %<latexrelease|fltrace>            \else
3319 %<*trace>
3320 %<latexrelease|fltrace>              \fl@trace{sent to addtotoporbot
3321 %<latexrelease|fltrace>                                 (addtonextcol)}%
3322 %</trace>
3323 %<latexrelease|fltrace>              \@addtotoporbot
3324 %<latexrelease|fltrace>            \fi
3325 %<latexrelease|fltrace>         \fi
3326 %<*trace>
3327 %<latexrelease|fltrace>       \else
3328 %<latexrelease|fltrace>         \fl@trace{Fail---no room: fl box ht:
3329 %<latexrelease|fltrace>              \the \ht \@currbox (addtonextcol)}%
3330 %</trace>
3331 %<latexrelease|fltrace>       \fi
3332 %<latexrelease|fltrace>     \fi
3333 %<latexrelease|fltrace>   \fi
3334 %<latexrelease|fltrace>   \if@insert
3335 %<latexrelease|fltrace>   \else
3336 %<*trace>
3337 %<latexrelease|fltrace>     \fl@trace{put back on deferlist
3338 %<latexrelease|fltrace>                                (addtonextcol)}%
3339 %</trace>
3340 %<latexrelease|fltrace>     \@cons\@deferlist\@currbox
3341 %<*trace>
3342 %<latexrelease|fltrace>     \fl@trace{deferlist: \@deferlist:
3343 %<latexrelease|fltrace>                           (addtonextcol-after)}%
3344 %</trace>
3345 %<latexrelease|fltrace>   \fi
3346 %<*trace>
3347 %<latexrelease|fltrace>   \fl@trace{End of addtonextcol --
3348 %<latexrelease|fltrace>                             locally counts:}%
3349 %<latexrelease|fltrace>   \fl@trace{col: \the \@colnum. 
3350 %<latexrelease|fltrace>      top: \the \@topnum. bot: \the \@botnum.}%
3351 %</trace>
3352 %<latexrelease|fltrace>  \endgroup
3353 %<*trace>
3354 %<latexrelease|fltrace>  \fl@trace{End of addtonextcol --
3355 %<latexrelease|fltrace>                           globally counts:}%
3356 %<latexrelease|fltrace>  \fl@trace{col: \the \@colnum.
3357 %<latexrelease|fltrace>        top: \the \@topnum. bot: \the \@botnum.}%
3358 %</trace>
3359 %<latexrelease|fltrace>}%
3360 %<latexrelease|fltrace>\EndIncludeInRelease
3361 %    \end{macrocode}
3363 %  \end{macro}
3365 %  \begin{macro}{\@addtodblcol}
3366 % \changes{v1.0f}{1993/12/05}{Command changed}
3367 %    Lots of changes.
3369 % \changes{v1.2n}{2015/01/14}{float order in 2-column (latexrelease)}
3370 %    \begin{macrocode}
3371 %<latexrelease|fltrace>\IncludeInRelease{2015/01/01}%
3372 %<latexrelease|fltrace>  {\@addtodblcol}{float order in 2-column}%
3373 %<*2ekernel|latexrelease|fltrace>
3374 \def\@addtodblcol{%
3375   \begingroup
3376 %<*trace>
3377   \fl@trace{***Start addtodblcol}%
3378 %</trace>
3379    \@insertfalse
3380    \@setfloattypecounts
3381    \@getfpsbit \tw@
3382 %<*trace>
3383    \fl@trace{fpstype \ifodd \@tempcnta OK \else not \fi dbltop:
3384                                                      \the \@fpstype}%
3385 %</trace>
3386    \ifodd\@tempcnta
3387      \@flsetnum \@dbltopnum
3388      \ifnum \@dbltopnum>\z@
3389        \@tempswafalse
3390        \ifdim \@dbltoproom>\ht\@currbox
3391          \@tempswatrue
3392 %<*trace>
3393          \fl@trace{Space OK: \@dbltoproom =
3394                 \the \@dbltoproom > \the \ht \@currbox
3395                                          (dbltoproom)}%
3396 %</trace>
3397        \else
3398 %<*trace>
3399          \fl@trace{fpstype: \the \@fpstype (addtodblcol)}%
3400 %</trace>
3401          \ifnum \@fpstype<\sixt@@n
3402 %<*trace>
3403            \fl@trace{BANG float ignoring \@dbltoproom}%
3404            \fl@trace{\@spaces \@dbltoproom = \the \@dbltoproom.
3405                            Ht float: \the \ht \@currbox-BANG}%
3406 %</trace>
3407 %    \end{macrocode}
3408 % Need to check that there is room on the page, using the local value
3409 % of |\@textmin| to make the necessary adjustment to |\@dbltoproom|.
3410 %    \begin{macrocode}
3411            \advance \@dbltoproom \@textmin
3412 %<*trace>
3413            \fl@trace{Local value of texmin: \the\@textmin}%
3414            \fl@trace{\@spaces space on page = \the \@dbltoproom.
3415                            Ht float: \the \ht \@currbox-BANG}%
3416 %</trace>
3417            \ifdim \@dbltoproom>\ht\@currbox
3418              \@tempswatrue
3419 %<*trace>
3420              \fl@trace{Space OK BANG: space on page =
3421                          \the \@dbltoproom > \the \ht \@currbox}%
3422            \else
3423              \fl@trace{fpstype: \the \@fpstype}%
3424              \fl@trace{Fail---no room dbltoproom-BANG?:}%
3425              \fl@trace{\@spaces space on page = \the \@dbltoproom.
3426                            Ht float: \the \ht \@currbox}%
3427 %</trace>
3428            \fi
3429            \advance \@dbltoproom -\@textmin
3430 %<*trace>
3431          \else
3432            \fl@trace{fpstype: \the \@fpstype}%
3433            \fl@trace{Fail---no room dbltoproom-ORD?:}%
3434            \fl@trace{\@spaces \@dbltoproom = \the \@dbltoproom.
3435                            Ht float: \the \ht \@currbox}%
3436 %</trace>
3437          \fi
3438        \fi
3439        \if@tempswa
3440            \@bitor \@currtype \@deferlist
3441 %<*trace>
3442            \fl@trace{(dbl)deferlist: \@deferlist: (before)}%
3443 %</trace>
3444 %    \end{macrocode}
3446 % not in fixfloats?
3447 %    \begin{macrocode}
3448           \@testwrongwidth\@currbox
3449 %    \end{macrocode}
3451 %    \begin{macrocode}
3452            \if@test
3453 %<*trace>
3454               \fl@trace{type already on list: (dbl)defer}%
3455 %</trace>
3456            \else
3457               \@tempdima -\ht\@currbox
3458               \advance\@tempdima
3459                 -\ifx \@dbltoplist\@empty \dbltextfloatsep \else
3460                                           \dblfloatsep \fi
3461               \global \advance \@dbltoproom \@tempdima
3462               \global \advance \@colht \@tempdima
3463               \global \advance \@dbltopnum \m@ne
3464               \@cons \@dbltoplist \@currbox
3465 %<*trace>
3466               \fl@trace{dbltopnum (after) = \the \@dbltopnum}%
3467               \fl@trace{***Success: dbltop}%
3468 %</trace>
3469               \@inserttrue
3470            \fi
3471        \fi
3472 %<*trace>
3473      \else
3474        \fl@trace{Fail: dbltopnum = \the \@dbltopnum: fpstype
3475                                                   \the \@fpstype=ORD?}%
3476        \ifnum \@fpstype<\sixt@@n
3477          \fl@trace{ERROR: !t float not successful (addtodblcol)}%
3478        \fi
3479 %</trace>
3480      \fi
3481    \fi
3482    \if@insert
3483    \else
3484 %<*trace>
3485      \fl@trace{put on deferlist}%
3486 %</trace>
3487      \@cons\@deferlist\@currbox
3488 %<*trace>
3489      \fl@trace{(dbl)deferlist: \@deferlist: (after)}%
3490 %</trace>
3491    \fi
3492 %<*trace>
3493    \fl@trace{End of addtodblcol -- locally count:}%
3494    \fl@trace{ dbltop: \the \@dbltopnum.}%
3495 %</trace>
3496   \endgroup
3497 %<*trace>
3498   \fl@trace{End of addtodblcol -- globally count:}%
3499   \fl@trace{dbltop: \the \@dbltopnum.}%
3500 %</trace>
3502 %</2ekernel|latexrelease|fltrace>
3503 %<latexrelease|fltrace>\EndIncludeInRelease
3504 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
3505 %<latexrelease|fltrace>  {\@addtodblcol}{float order in 2-column}%
3506 %<latexrelease|fltrace>\def\@addtodblcol{%
3507 %<latexrelease|fltrace>  \begingroup
3508 %<*trace>
3509 %<latexrelease|fltrace>  \fl@trace{***Start addtodblcol}%
3510 %</trace>
3511 %<latexrelease|fltrace>   \@insertfalse
3512 %<latexrelease|fltrace>   \@setfloattypecounts
3513 %<latexrelease|fltrace>   \@getfpsbit \tw@
3514 %<*trace>
3515 %<latexrelease|fltrace>   \fl@trace{fpstype \ifodd \@tempcnta OK
3516 %<latexrelease|fltrace>                \else not \fi dbltop: \the \@fpstype}%
3517 %</trace>
3518 %<latexrelease|fltrace>   \ifodd\@tempcnta
3519 %<latexrelease|fltrace>     \@flsetnum \@dbltopnum
3520 %<latexrelease|fltrace>     \ifnum \@dbltopnum>\z@
3521 %<latexrelease|fltrace>       \@tempswafalse
3522 %<latexrelease|fltrace>       \ifdim \@dbltoproom>\ht\@currbox
3523 %<latexrelease|fltrace>         \@tempswatrue
3524 %<*trace>
3525 %<latexrelease|fltrace>         \fl@trace{Space OK: \@dbltoproom =
3526 %<latexrelease|fltrace>                \the \@dbltoproom > \the \ht \@currbox
3527 %<latexrelease|fltrace>                                         (dbltoproom)}%
3528 %</trace>
3529 %<latexrelease|fltrace>       \else
3530 %<*trace>
3531 %<latexrelease|fltrace>      \fl@trace{fpstype: \the \@fpstype (addtodblcol)}%
3532 %</trace>
3533 %<latexrelease|fltrace>         \ifnum \@fpstype<\sixt@@n
3534 %<*trace>
3535 %<latexrelease|fltrace>           \fl@trace{BANG float ignoring \@dbltoproom}%
3536 %<latexrelease|fltrace>           \fl@trace{\@spaces \@dbltoproom =
3537 %<latexrelease|fltrace>                    \the \@dbltoproom.
3538 %<latexrelease|fltrace>                    Ht float: \the \ht \@currbox-BANG}%
3539 %</trace>
3540 %    \end{macrocode}
3541 % Need to check that there is room on the page, using the local value
3542 % of |\@textmin| to make the necessary adjustment to |\@dbltoproom|.
3543 %    \begin{macrocode}
3544 %<latexrelease|fltrace>           \advance \@dbltoproom \@textmin
3545 %<*trace>
3546 %<latexrelease|fltrace>       \fl@trace{Local value of texmin: \the\@textmin}%
3547 %<latexrelease|fltrace>       \fl@trace{\@spaces space on page =
3548 %<latexrelease|fltrace>                   \the \@dbltoproom.
3549 %<latexrelease|fltrace>                    Ht float: \the \ht \@currbox-BANG}%
3550 %</trace>
3551 %<latexrelease|fltrace>           \ifdim \@dbltoproom>\ht\@currbox
3552 %<latexrelease|fltrace>             \@tempswatrue
3553 %<*trace>
3554 %<latexrelease|fltrace>         \fl@trace{Space OK BANG: space on page =
3555 %<latexrelease|fltrace>                 \the\@dbltoproom > \the\ht\@currbox}%
3556 %<latexrelease|fltrace>           \else
3557 %<latexrelease|fltrace>         \fl@trace{fpstype: \the \@fpstype}%
3558 %<latexrelease|fltrace>         \fl@trace{Fail---no room dbltoproom-BANG?:}%
3559 %<latexrelease|fltrace>         \fl@trace{\@spaces space on page =
3560 %<latexrelease|fltrace>                      \the \@dbltoproom.
3561 %<latexrelease|fltrace>                       Ht float: \the \ht \@currbox}%
3562 %</trace>
3563 %<latexrelease|fltrace>           \fi
3564 %<latexrelease|fltrace>           \advance \@dbltoproom -\@textmin
3565 %<*trace>
3566 %<latexrelease|fltrace>         \else
3567 %<latexrelease|fltrace>           \fl@trace{fpstype: \the \@fpstype}%
3568 %<latexrelease|fltrace>           \fl@trace{Fail---no room dbltoproom-ORD?:}%
3569 %<latexrelease|fltrace>           \fl@trace{\@spaces \@dbltoproom =
3570 %<latexrelease|fltrace>              \the \@dbltoproom.
3571 %<latexrelease|fltrace>              Ht float: \the \ht \@currbox}%
3572 %</trace>
3573 %<latexrelease|fltrace>         \fi
3574 %<latexrelease|fltrace>       \fi
3575 %<latexrelease|fltrace>       \if@tempswa
3576 %<latexrelease|fltrace>           \@bitor \@currtype \@dbldeferlist
3577 %<*trace>
3578 %<latexrelease|fltrace>           \fl@trace{dbldeferlist:
3579 %<latexrelease|fltrace>                      \@dbldeferlist: (before)}%
3580 %</trace>
3581 %<latexrelease|fltrace>           \if@test
3582 %<*trace>
3583 %<latexrelease|fltrace>             \fl@trace{type already on list: dbldefer}%
3584 %</trace>
3585 %<latexrelease|fltrace>           \else
3586 %<latexrelease|fltrace>              \@tempdima -\ht\@currbox
3587 %<latexrelease|fltrace>              \advance\@tempdima
3588 %<latexrelease|fltrace>                -\ifx \@dbltoplist\@empty
3589 %<latexrelease|fltrace>                      \dbltextfloatsep
3590 %<latexrelease|fltrace>                 \else \dblfloatsep \fi
3591 %<latexrelease|fltrace>              \global \advance \@dbltoproom \@tempdima
3592 %<latexrelease|fltrace>              \global \advance \@colht \@tempdima
3593 %<latexrelease|fltrace>              \global \advance \@dbltopnum \m@ne
3594 %<latexrelease|fltrace>              \@cons \@dbltoplist \@currbox
3595 %<*trace>
3596 %<latexrelease|fltrace>              \fl@trace{dbltopnum (after) =
3597 %<latexrelease|fltrace>                                    \the \@dbltopnum}%
3598 %<latexrelease|fltrace>              \fl@trace{***Success: dbltop}%
3599 %</trace>
3600 %<latexrelease|fltrace>              \@inserttrue
3601 %<latexrelease|fltrace>           \fi
3602 %<latexrelease|fltrace>       \fi
3603 %<*trace>
3604 %<latexrelease|fltrace>     \else
3605 %<latexrelease|fltrace>       \fl@trace{Fail: dbltopnum = \the \@dbltopnum:
3606 %<latexrelease|fltrace>                          fpstype \the \@fpstype=ORD?}%
3607 %<latexrelease|fltrace>       \ifnum \@fpstype<\sixt@@n
3608 %<latexrelease|fltrace>         \fl@trace{ERROR: !t float not successful
3609 %<latexrelease|fltrace>                                        (addtodblcol)}%
3610 %<latexrelease|fltrace>       \fi
3611 %</trace>
3612 %<latexrelease|fltrace>     \fi
3613 %<latexrelease|fltrace>   \fi
3614 %<latexrelease|fltrace>   \if@insert
3615 %<latexrelease|fltrace>   \else
3616 %<*trace>
3617 %<latexrelease|fltrace>     \fl@trace{put on dbldeferlist}%
3618 %</trace>
3619 %<latexrelease|fltrace>     \@cons\@dbldeferlist\@currbox
3620 %<*trace>
3621 %<latexrelease|fltrace>     \fl@trace{dbldeferlist: \@dbldeferlist: (after)}%
3622 %</trace>
3623 %<latexrelease|fltrace>   \fi
3624 %<*trace>
3625 %<latexrelease|fltrace>   \fl@trace{End of addtodblcol -- locally count:}%
3626 %<latexrelease|fltrace>   \fl@trace{ dbltop: \the \@dbltopnum.}%
3627 %</trace>
3628 %<latexrelease|fltrace>  \endgroup
3629 %<*trace>
3630 %<latexrelease|fltrace>  \fl@trace{End of addtodblcol -- globally count:}%
3631 %<latexrelease|fltrace>  \fl@trace{dbltop: \the \@dbltopnum.}%
3632 %</trace>
3633 %<latexrelease|fltrace>}%
3634 %<latexrelease|fltrace>\EndIncludeInRelease
3635 %    \end{macrocode}
3636 %  \end{macro}
3640 % \begin{macro}{\@addmarginpar}
3641 %    \begin{macrocode}
3642 %<*2ekernel>
3643 \def\@addmarginpar{\@next\@marbox\@currlist{\@cons\@freelist\@marbox
3644     \@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne
3645     \if@twocolumn
3646         \if@firstcolumn \@tempcnta\m@ne \fi
3647     \else
3648       \if@mparswitch
3649          \ifodd\c@page \else\@tempcnta\m@ne \fi
3650       \fi
3651       \if@reversemargin \@tempcnta -\@tempcnta \fi
3652     \fi
3653     \ifnum\@tempcnta <\z@  \global\setbox\@marbox\box\@currbox \fi
3654     \@tempdima\@mparbottom
3655     \advance\@tempdima -\@pageht
3656     \advance\@tempdima\ht\@marbox
3657     \ifdim\@tempdima >\z@
3658       \@latex@warning@no@line {Marginpar on page \thepage\space moved}%
3659     \else
3660       \@tempdima\z@
3661     \fi
3662     \global\@mparbottom\@pageht
3663     \global\advance\@mparbottom\@tempdima
3664     \global\advance\@mparbottom\dp\@marbox
3665     \global\advance\@mparbottom\marginparpush
3666     \advance\@tempdima -\ht\@marbox
3667 %    \end{macrocode}
3668 % Putting box movement inside the `marbox':
3669 %    \begin{macrocode}
3670     \global\setbox \@marbox
3671                    \vbox {\vskip \@tempdima
3672                           \box \@marbox}%
3673     \global \ht\@marbox \z@
3674     \global \dp\@marbox \z@
3675 %    \end{macrocode}
3676 % Sticking (rather than gluing:-) the `marbox' to the line above,
3677 % changed vskip to kern:
3678 %    \begin{macrocode}
3679     \kern -\@pagedp
3680     \nointerlineskip
3681     \hb@xt@\columnwidth
3682       {\ifnum \@tempcnta >\z@
3683           \hskip\columnwidth \hskip\marginparsep
3684        \else
3685           \hskip -\marginparsep \hskip -\marginparwidth
3686        \fi
3687        \box\@marbox \hss}%
3688 %    \end{macrocode}
3689 %    For this reason the following code can vanish:
3690 %\begin{verbatim}
3691 %    \nobreak             %% No longer needed.  CAR92/12
3692 %    \vskip -\@tempdima   %% No longer needed.  CAR92/12
3693 %\end{verbatim}
3694 %    \begin{macrocode}
3695     \nointerlineskip
3696     \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}}
3697 %    \end{macrocode}
3698 % \end{macro}
3700 % \subsubsection{Kludgeins}
3702 % This part of the file is part of the implementation of the following
3703 % two new commands for \LaTeX2e{}.
3706 % \begin{verbatim}
3707 % \enlargethispage{<dim>}
3708 % \end{verbatim}
3710 % Adds |<dim>| to the height of the current column only. On the printed
3711 % page the bottom of this column is extended downwards by exactly
3712 % |<dim>| without having any effect on the placement of the footer; this
3713 % may result in an overprinting.
3715 % \begin{verbatim}
3716 % \enlargethispage*{<dim>}
3717 % \end{verbatim}
3719 % Similar to |\enlargethispage| but it tries to squeeze the column to
3720 % be printed in as small a space as possible, ie it uses any
3721 % shrinkability in the column. If the column was not explicitly broken
3722 % (\eg with |\pagebreak|) this may result in an overfull box message but
3723 % execpt for this it will come out as expected (if you know what to
3724 % expect).
3726 % The star form of this command is dedicated to Leslie Lamport, the
3727 % other we need for ourselves (FMi, CAR).
3729 % These commands may well have unwanted effects if used soon
3730 % before a |\clearpage|: please give keep them clear of such places.
3732 %  \begin{macro}{\@kludgeins}
3733 % \changes{v0.1c}{1993/11/23}{Insert added}
3734 %    The insert which makes \TeX{} do a lot of the necessary work.
3735 %    All we need to put into it is the amount by which the pagegoal
3736 %    should be changed.
3737 %    \begin{macrocode}
3738 \newinsert \@kludgeins
3739 \global\dimen\@kludgeins \maxdimen
3740 \global\count\@kludgeins 1000
3741 %    \end{macrocode}
3742 %  \end{macro}
3745 %  \begin{macro}{\enlargethispage}
3746 %  \begin{macro}{\enlargethispage*}
3747 % \changes{v0.1c}{1993/11/23}{Commands added}
3748 %    The user command.
3749 %    \begin{macrocode}
3750 \gdef \enlargethispage {%
3751    \@ifstar
3752      {%
3753 %<*trace>
3754       \fl@trace{Enlarging page height * }%
3755 %</trace>
3756       \@enlargepage{\hbox{\kern\p@}}}%
3757      {%
3758 %<*trace>
3759       \fl@trace{Enlarging page height exactly---}%
3760 %</trace>
3761       \@enlargepage\@empty}%
3763 %    \end{macrocode}
3764 %  \end{macro}
3765 %  \end{macro}
3768 %  \begin{macro}{\@enlargepage}
3769 % \changes{v0.1c}{1993/11/23}{Command added}
3770 %    This actually inserts the insert, after checking for extreme
3771 %    values of the change.
3772 %    \begin{macrocode}
3773 \gdef\@enlargepage#1#2{%
3774 %<*trace>
3775    \fl@trace{\@spaces\@spaces by #2}%
3776 %</trace>
3777    \@tempskipa#2\relax
3778    \ifdim \@tempskipa>.5\maxdimen
3779      \@latexerr{Suggested\space extra\space height\space
3780                 (\the\@tempskipa)\space dangerously\space
3781                 large}\@eha
3782    \else
3783      \ifdim \vsize<.5\maxdimen
3784 %<*trace>
3785        \fl@trace {Kludgeins added--pagegoal before: \the\pagegoal}%
3786 %</trace>
3787        \@bsphack
3788          \insert\@kludgeins{#1\vskip-\@tempskipa}%
3789        \@esphack
3790 %    \end{macrocode}
3791 %    This next bit is for tracing only:
3792 %    \begin{macrocode}
3793 %<*trace>
3794        \ifvmode \par
3795          \fl@trace {Kludgeins added--pagegoal after: \the \pagegoal}%
3796        \fi
3797 %</trace>
3798      \else
3799        \@latexerr{Page\space height\space already\space
3800                   too\space large}\@eha
3801      \fi
3802    \fi
3804 %</2ekernel>
3805 %    \end{macrocode}
3806 %  \end{macro}
3808 % \subsubsection{Float control}
3810 % This part implements controllable floats and other changes
3811 % to the float mechanism.
3813 % It provides, at the document level, the following command for
3814 % inclusion in \LaTeX2e{}.
3816 % \begin{verbatim}
3817 %     \suppressfloats
3818 % \end{verbatim}
3820 % This suppresses all further floats on the current page.
3822 % With an optional argument it suppresses only floats only in certain
3823 % positions on the current page.
3824 % \begin{quote}
3825 %  |[t]|\quad suppresses only floats at the top of the page
3826 %  |[b]|\quad suppresses only floats at the bottom of the page
3827 % \end{quote}
3829 % It also enables the use of an extra specifier, {\tt !}, in the
3830 % location optional argument of a float.  If this is present then,
3831 % just for this particular float, whenever it is processed by the float
3832 % mechanism the followinhg are ignored:
3834 % \begin{itemize}
3835 % \item  all restrictions on the number of floats which can appear;
3836 % \item  all explicit restrictions on the amount of space which should
3837 %   (not) be occupied by floats and/or text.
3838 % \end{itemize}
3840 % The mechanism will still attempt to ensure that pages are not
3841 % overfull.
3843 % These specifiers override, for the single float, the suppression
3844 % commands described above.
3847 % In its current form, it also supplies a reasonably exhaustive, and
3848 % somewhat baroque, means of tracing some aspects of the float
3849 % mechanism.
3851 % More tracing.
3852 %  \begin{macro}{\fl@trace}
3853 %  \begin{macro}{\tracefloatsoff}
3854 %  \begin{macro}{\tracefloats}
3855 %  \begin{macro}{\fl@traceval}
3856 %  \begin{macro}{\tracefloatvals}
3857 %  \begin{macro}{\fl@tracemessage}
3858 % \changes{v1.0c}{1993/11/30}{Commands added}
3859 % \changes{v1.0h}{1993/12/12}{Commands changed}
3860 % \changes{v1.0j}{1993/12/17}{tracefloatvals made a document command}
3861 %    Set-up tracing for floats independent of other tracing as it
3862 %    produces mega-output.  Default is no tracing.
3863 % \changes{v1.1j}{1995/04/24}
3864 %   {Do not add to kernel unless `trace' specified}
3865 % \changes{v1.2n}{2014/04/24}
3866 %   {Renamed internal trace commands; provide as package}
3868 %    \begin{macrocode}
3869 %<*fltrace>
3870 \def \fl@tracemessage #1{{\let\@elt\@empty\typeout{LaTeX2e: #1}}}
3871 \def \tracefloats{\let \fl@trace \fl@tracemessage}
3872 \def \tracefloatsoff {\let \fl@trace \@gobble}
3873 \tracefloatsoff
3874 \def \fl@traceval #1{\fl@trace{\string #1 = \the #1}}
3875 \IncludeInRelease{2015/01/01}{\tracefloatvals}%
3876                           {trace float vals}%
3877 \def \tracefloatvals{%
3878 %    \end{macrocode}
3879 %    As |\@dblfloatplacement| sets |\f@depth| it needs to be run
3880 %   inside a group, otherwise the float placement will test for the
3881 %   wrong value.\footnote{This is a somewhat questionable design.}
3882 %    \begin{macrocode}
3883  \begingroup
3884   \@dblfloatplacement
3885   \@floatplacement
3886   \fl@trace{***Float placement parameters:}%
3887   \fl@traceval\@colnum
3888   \fl@traceval\@colroom
3889   \fl@traceval\@topnum
3890   \fl@traceval\@toproom
3891   \fl@traceval\@botnum
3892   \fl@traceval\@botroom
3893   \fl@traceval\@fpmin
3894   \fl@trace{\string\textfraction = \textfraction}%
3895   \fl@traceval\@dbltopnum
3896   \fl@traceval\@dbltoproom
3897   \fl@trace{\string\textfraction = \textfraction}%
3898   \fl@trace{toplist: \@toplist}%
3899   \fl@trace{botlist: \@botlist}%
3900   \fl@trace{midlist: \@midlist}%
3901   \fl@trace{deferlist: \@deferlist}%
3902   \fl@trace{dbltoplist: \@dbltoplist}%
3903 %FMi  \fl@trace{dbldeferlist: \@dbldeferlist}%
3904  \endgroup
3906 \EndIncludeInRelease
3907 \IncludeInRelease{0000/00/00}{\tracefloatvals}%
3908                           {trace float vals}%
3909 \def \tracefloatvals{%
3910  \begingroup
3911   \@dblfloatplacement
3912   \@floatplacement
3913   \fl@trace{***Float placement parameters:}%
3914   \fl@traceval\@colnum
3915   \fl@traceval\@colroom
3916   \fl@traceval\@topnum
3917   \fl@traceval\@toproom
3918   \fl@traceval\@botnum
3919   \fl@traceval\@botroom
3920   \fl@traceval\@fpmin
3921   \fl@trace{\string\textfraction = \textfraction}%
3922   \fl@traceval\@dbltopnum
3923   \fl@traceval\@dbltoproom
3924   \fl@trace{\string\textfraction = \textfraction}%
3925   \fl@trace{toplist: \@toplist}%
3926   \fl@trace{botlist: \@botlist}%
3927   \fl@trace{midlist: \@midlist}%
3928   \fl@trace{deferlist: \@deferlist}%
3929   \fl@trace{dbltoplist: \@dbltoplist}%
3930 % next line only in old releases
3931   \fl@trace{dbldeferlist: \@dbldeferlist}%
3932  \endgroup
3934 \EndIncludeInRelease
3935 %    \end{macrocode}
3936 %    We need to make sure that \texttt{fltrace} comes before
3937 %    \texttt{flafter} to make the tracing work.
3938 %    \begin{macrocode}
3939 \@ifpackageloaded{flafter}
3940  {\PackageWarningNoLine
3941       {fltrace}{Load 'fltrace' before 'flafter'\MessageBreak
3942                 Attempting to recover by reloading 'flafter'}%
3943 %    \end{macrocode}
3944 %    Hide the fact that \texttt{flafter} was already loaded and then
3945 %    request it anew.
3946 % \changes{v1.2m}{2015/01/20}{Reset \cs{IncludeInRelease} flags}
3947 %    \begin{macrocode}
3948     \expandafter\let\csname ver@flafter.sty\endcsname\relax
3949     \def\reserved@a#1{%
3950       \expandafter\let\csname\string#1+flafter+IIR\endcsname\relax}%
3951     \reserved@a\@addtocurcol
3952     \reserved@a\@addtonextcol
3953     \RequirePackage{flafter}}{}
3954 %</fltrace>
3955 %    \end{macrocode}
3956 %    As the code for \texttt{flafter} will contain tracing calls so
3957 %    that it works in conjunction with \texttt{fltrace} we need to
3958 %    provide a dummy definition for |\fl@trace| in that package.
3959 %    \begin{macrocode}
3960 %<*flafter>
3961 \providecommand\fl@trace[1]{}
3962 %</flafter>
3963 %    \end{macrocode}
3964 %  \end{macro}
3965 %  \end{macro}
3966 %  \end{macro}
3967 %  \end{macro}
3968 %  \end{macro}
3969 %  \end{macro}
3971 %  \begin{macro}{\suppressfloats}
3972 %  \begin{macro}{\@flstop}
3973 % \changes{v1.0f}{1993/12/05}{Commands added}
3974 % Float suppression commands: these set the relevant counter
3975 % globally to zero.  Thus they are overridden for a particular float
3976 % by an ! specifier.
3978 %    \begin{macrocode}
3979 %<*2ekernel>
3980 \def \suppressfloats {%
3981    \@ifnextchar [%
3982      \@flstop
3983     {\global \@colnum \z@}%
3985 %    \end{macrocode}
3986 % Maybe this should be a loop over |#1|?
3987 %    \begin{macrocode}
3988 \def \@flstop [#1]{%
3989    \if t#1%
3990      \global \@topnum \z@
3991    \fi
3992    \if b#1%
3993      \global \@botnum \z@
3994    \fi
3996 %    \end{macrocode}
3997 %  \end{macro}
3998 %  \end{macro}
4001 % Manipulation of float placement and type; both their strings and the
4002 % corresponding count registers.
4004 %  \begin{macro}{\@fpstype}
4005 %  \begin{macro}{\@reqcolroom}
4006 %  \begin{macro}{\@textfloatsheight}
4007 % \changes{v1.0f}{1993/12/05}{Commands added}
4008 % First a new count register to go with |\@currtype|.
4010 % Then a new skip register, for information needed to remove the
4011 % |\@maxsep| conservatism: it is possible that this could use a
4012 % temporary register.
4014 % Finally a dimension register to hold the total height of in-text
4015 % floats on the current page.  This is needed to implement a
4016 % major change in the functionality of |\@addtocurcol| which is,
4017 % nevertheless, a bug fix.
4018 % It is not local and therefore cannot be a temporary register.
4020 %    \begin{macrocode}
4021 \newcount \@fpstype
4022 \newdimen \@reqcolroom
4023 \newdimen \@textfloatsheight
4024 %</2ekernel>
4025 %    \end{macrocode}
4026 %  \end{macro}
4027 %  \end{macro}
4028 %  \end{macro}
4030 %  \begin{macro}{\@fpsadddefault}
4031 % \changes{v1.0f}{1993/12/05}{Command added}
4032 % Adds the default placement to what is already there.
4034 % Should not need to change this, but could do it as follows:
4035 % \begin{verbatim}
4036 %\def \@fpsadddefault {%
4037 %   \@temptokena \expandafter\expandafter\expandafter
4038 %                {\csname fps@\@captype \endcsname}%
4039 %   \edef \reserved@a {\the\@temptokena}%
4040 %   \@onelevel@sanitize \reserved@a
4041 %   \edef \@fps {\@fps\reserved@a}%
4043 % \end{verbatim}
4045 %    \begin{macrocode}
4046 %<*2ekernel|fltrace>
4047 \def \@fpsadddefault {%
4048 %<*trace>
4049    \fl@trace{fps changed from: \@fps}%
4050 %</trace>
4051    \edef \@fps {\@fps\csname fps@\@captype \endcsname}%
4052    \@latex@warning {%
4053      No positions in optional float specifier.\MessageBreak
4054      Default added (so using `\@fps')}%
4056 %    \end{macrocode}
4057 %  \end{macro}
4059 %  \begin{macro}{\@setfloattypecounts}
4060 % \changes{v1.0f}{1993/12/05}{Command added}
4061 % Sets counters |\@fpstype| and |\@currtype|.
4063 % BANG $==$ bit4 of $|\count\@currbox| = 0$.
4065 %    \begin{macrocode}
4066 \def \@setfloattypecounts {%
4067   \@currtype \count\@currbox
4068   \@fpstype \count\@currbox
4069   \divide\@currtype\@xxxii \multiply\@currtype\@xxxii
4070   \advance \@fpstype -\@currtype
4071 %<*trace>
4072   \fl@trace{(mod 32) fpstype: \the \@fpstype}%
4073   \fl@trace{(mult of 32) currtype: \the \@currtype}%
4074 % Tracing only: but some should be changed into real errors/warnings?
4075   \ifnum \@fpstype<\sixt@@n
4076     \ifnum \@fpstype=\z@
4077       \fl@trace{ERROR: no PLACEMENT, fpstype = \the \@fpstype = 0?}%
4078     \fi
4079     \ifnum \@fpstype=\@ne
4080       \fl@trace{WARNING: only h, fpstype = \the \@fpstype = 1?}%
4081     \fi
4082     \fl@trace{BANG float}%
4083   \else
4084     \ifnum \@fpstype=\sixt@@n
4085       \fl@trace{ERROR: no PLACEMENT, fpstype = \the \@fpstype = 16?}%
4086     \fi
4087     \ifnum \@fpstype=17
4088       \fl@trace{WARNING: only h, fpstype = \the \@fpstype = 17?}%
4089     \fi
4090     \fl@trace{ORD float}%
4091   \fi
4092 %</trace>
4094 %</2ekernel|fltrace>
4095 %    \end{macrocode}
4096 %  \end{macro}
4098 % Macros for getting, testing and setting bits of the fps.
4101 %  \begin{macro}{\@getfpsbit}
4102 % \changes{v1.0f}{1993/12/05}{Command added}
4103 % Sets |\@tempcnta| to required bit of |\count\@currbox|.
4105 %    \begin{macrocode}
4106 %<*2ekernel>
4107 \def \@getfpsbit {%
4108    \@boxfpsbit \@currbox
4110 %    \end{macrocode}
4111 %  \end{macro}
4114 %  \begin{macro}{\@boxfpsbit}
4115 % \changes{v1.0f}{1993/12/05}{Command added}
4116 %    Used above.
4117 %    \begin{macrocode}
4118 \def \@boxfpsbit #1#2{%
4119    \@tempcnta \count#1%
4120    \divide \@tempcnta #2\relax
4122 %    \end{macrocode}
4123 %  \end{macro}
4125 %  \begin{macro}{\@testfp}
4126 % \changes{v1.0f}{1993/12/05}{Command added}
4127 % New definition of the float page test.
4129 % \changes{v1.1v}{1996/07/26}{remove \cs{global} before \cs{@test...}}
4130 %    \begin{macrocode}
4131 \def \@testfp #1{%
4132    \@boxfpsbit #18\relax % Really `#1 8' for human readers!
4133    \ifodd \@tempcnta
4134    \else
4135      \@testtrue
4136    \fi
4138 %    \end{macrocode}
4139 %  \end{macro}
4142 %  \begin{macro}{\@setfpsbit}
4143 % \changes{v1.0f}{1993/12/05}{Command added}
4144 % Sets required bit of |\@tempcnta| (to 1).
4146 %    \begin{macrocode}
4147 \def \@setfpsbit #1{%
4148    \@tempcntb \@tempcnta
4149    \divide \@tempcntb #1\relax
4150    \ifodd \@tempcntb
4151    \else
4152      \advance \@tempcnta #1\relax
4153    \fi
4155 %</2ekernel>
4156 %    \end{macrocode}
4157 %  \end{macro}
4160 %  \begin{macro}{\@resethfps}
4161 % \changes{v1.0f}{1993/12/05}{Command added}
4162 % \changes{v1.0h}{1993/12/12}{Warnings added: minimal}
4163 % \changes{v1.0m}{1994/04/24}{Warning changed}
4164 % \changes{v1.0m}{1994/04/24}{Number 2 changed to \cs{tw@}}
4165 % \changes{v1.0o}{1994/05/02}{Code shortened}
4166 % Globally adds t as a possible location for an h or !h only placement:
4167 % this must be done using the count.
4169 % Although it will leave |\@fpstype| set to 17 even if it was
4170 % originally 1, this does not matter since it is the last thing in
4171 % |\@addtocurcol|.
4172 %    \begin{macrocode}
4173 %<*2ekernel|fltrace>
4174 \def \@resethfps {%
4175    \let\reserved@a\@empty
4176    \ifnum \@fpstype=\@ne
4177       \def \reserved@a {!}%
4178       \@fpstype 17
4179    \fi
4180    \ifnum \@fpstype=17
4181      \global \advance \count\@currbox \tw@
4182      \@latex@warning@no@line {%
4183        `\reserved@a h' float specifier changed to `\reserved@a ht'}%
4184 %<*trace>
4185      \fl@trace{%
4186         `t' added to `\reserved@a h'- new Count: \the \count\@currbox}%
4187 %</trace>
4188    \fi
4190 %    \end{macrocode}
4191 %  \end{macro}
4194 % Special stuff for BANG floats.
4196 %  \begin{macro}{\@flsetnum}
4197 % \changes{v1.0f}{1993/12/05}{Command added}
4199 % Ignores any zero float counter value in case BANG.
4201 % It uses a local assignment to the normally global counter: a bit
4202 % naughty, perhaps?
4204 % These assignments are safe so long as the counter involved is only
4205 % consulted once (\ie only for the `bang float') with the changed value.
4206 % This is the case within |\@addtocurcol| because it is used only
4207 % once within a call of the output routine (which forms a group).
4209 % For |\@addtonextcol| this is achieved by putting a group around its
4210 % code; this is needed because it is called (by |\@startcolumn|) for
4211 % each float which was on the deferlist.  Almost identical
4212 % considerations pertain to |\@addtodblcol|.  There may be more
4213 % efficient ways to handle this, but the group seems to be the simplest.
4215 % \changes{v1.0n}{1994/04/30}{Rogue space removed}
4216 %    \begin{macrocode}
4217 \def \@flsetnum #1{%
4218 %<*trace>
4219    \fl@trace{fpstype: \the \@fpstype (flsetnum \string#1)}%
4220 %</trace>
4221    \ifnum \@fpstype<\sixt@@n
4222      \ifnum #1=\z@
4223 %<*trace>
4224        \fl@trace{BANG float resetting \string#1 to 1}%
4225 %</trace>
4226        #1\@ne
4227      \fi
4228    \fi
4229 %<*trace>
4230    \fl@trace{#1 (before) = \the #1}%
4231 %</trace>
4233 %    \end{macrocode}
4234 %  \end{macro}
4237 %  \begin{macro}{\@flsettextmin}
4238 % \changes{v1.0f}{1993/12/05}{Command added}
4239 % This ignores |\textfraction| space restriction in case BANG.
4241 %    \begin{macrocode}
4242 \def \@flsettextmin {%
4243 %<*trace>
4244    \fl@trace{fpstype: \the \@fpstype (flsettextmin)}%
4245 %</trace>
4246    \ifnum \@fpstype<\sixt@@n
4247 %<*trace>
4248      \fl@trace{BANG ignoring textmin}%
4249 %</trace>
4250      \@textmin \z@
4251    \else
4252      \@textmin \textfraction\@colht
4253 %<*trace>
4254      \fl@trace{ORD textmin = \the \@textmin}%
4255 %</trace>
4256    \fi
4258 %    \end{macrocode}
4259 %  \end{macro}
4262 %  \begin{macro}{\@flcheckspace}
4263 % \changes{v1.0f}{1993/12/05}{Command added}
4264 % This ignores space restriction in case BANG; this is still slightly
4265 % conservative since it does not allow for the fact that, if there is
4266 % no text in the column then |\textfloatsep| is not needed.
4267 % Sets |@tempswa| true if there is room for |\@currbox|.
4269 %    \begin{macrocode}
4270 \def \@flcheckspace #1#2{%
4271    \advance \@reqcolroom
4272      \ifx #2\@empty \textfloatsep \else \floatsep \fi
4273 %<*trace>
4274    \fl@trace{colroom = \the \@colroom 
4275                                    (flcheckspace \string#1 \string#2)}%
4276    \fl@trace{reqcolroom = \the \@reqcolroom
4277                                    (flcheckspace \string#1 \string#2)}%
4278 %</trace>
4279    \ifdim \@colroom>\@reqcolroom
4280      \ifdim #1>\ht\@currbox
4281        \@tempswatrue
4282 %<*trace>
4283        \fl@trace{Space OK: #1 = \the #1 > \the \ht \@currbox
4284                                    (flcheckspace \string#1 \string#2)}%
4285 %</trace>
4286      \else
4287 %<*trace>
4288        \fl@trace{fpstype: \the \@fpstype
4289                                    (flcheckspace \string#1 \string#2)}%
4290 %</trace>
4291        \ifnum \@fpstype<\sixt@@n
4292 %<*trace>
4293          \fl@trace{BANG float ignoring #1
4294                                    (flcheckspace \string#1 \string#2):}%
4295          \fl@trace{\@spaces #1 = \the #1.  Ht float: \the \ht \@currbox
4296                                                           BANG}%
4297 %</trace>
4298          \@tempswatrue
4299 %<*trace>
4300        \else
4301          \fl@trace{Fail---no room (flcheckspace \string#1 \string#2)
4302                        (fpstype \the \@fpstype=ORD?):}%
4303          \fl@trace{\@spaces #1 = \the #1.  Ht float: \the \ht \@currbox
4304                                                           ORD?}%
4305 %</trace>
4306        \fi
4307      \fi
4308 %<*trace>
4309    \else
4310      \fl@trace{Fail---no room at 2nd test of colroom
4311                    (flcheckspace \string#1 \string#2)}%
4312 %</trace>
4313    \fi
4315 %</2ekernel|fltrace>
4316 %    \end{macrocode}
4317 %  \end{macro}
4320 %  \begin{macro}{\@flupdates}
4321 % \changes{v1.0f}{1993/12/05}{Command added}
4322 %    This updates everything when a float is placed.
4324 %    \begin{macrocode}
4325 %<*2ekernel>
4326 \def \@flupdates #1#2#3{%
4327    \global \advance #1\m@ne
4328    \global \advance \@colnum \m@ne
4329    \@tempdima -\ht\@currbox
4330    \advance \@tempdima
4331      -\ifx #3\@empty \textfloatsep \else \floatsep \fi
4332    \global \advance #2\@tempdima
4333    \global \advance \@colroom \@tempdima
4334    \@cons #3\@currbox
4336 %</2ekernel>
4337 %    \end{macrocode}
4338 %  \end{macro}
4341 % Interesting facts about float mechanisms past and present, together
4342 % with a summary of various features, some unresolved:
4344 % \begin{enumerate}
4345 %   \item  The value |\textfraction| does not affect the processing
4346 %     of doublecol floats: this seems sensible, but should be
4347 %     documented.
4348 %   \item |\twocolumn| floatplacement was wrong: dbl not needed, ord
4349 %     needed.
4350 %   \item |\@floatplacement| was not called after |\@startdblcol|
4351 %     or |\@topnewpage|.  This has been changed; it is clearly a bug
4352 %     fix.
4353 %   \item The use |\@topnewpage| when |\dblfigrule| is non-trivial
4354 %   produced a rule in the wrong place.  This has been fixed by not
4355 %   using |\dblfigrule| when processing the `float' from
4356 %   |\@topnewpage|.
4357 %   \item  If the specifier was just h and the float could not be put
4358 %     here, it went on the deferlist and stayed there until a clearpage.
4359 %     It now gets changed to a `th': this is only an error-recovery
4360 %     action, putting just h or !h should be deprecated.
4361 %   \item |\@dblmaxsep| was `the maximum of |\dblfloatsep| and
4362 %     |\dbltexfloatsep|'. But it was never used!  Now gone completely,
4363 %     like |\@maxsep|.
4364 %   \item After an h float is put on a page, it was counted as text when
4365 %     applying the |\textfraction| test; this is possibly too big a
4366 %     change although it is a bug fix?
4367 %   \item  Two consecutive h floats are separated by twice |\intextsep|:
4368 %     this could be changed to one by use of |\addvspace|, OK?
4369 %     Note that it would also mean that less space is put in if an h
4370 %     float  immediately follows other spaces.  This is also possibly
4371 %     too big a change, at least for compatibility mode?
4372 %     Or it may be simply wrong!  It has not been changed.
4373 %   \item Now |\@addtocurcol| checks first for just p fps.  I think
4374 %     that this is an increase in efficiency, but maybe the coding
4375 %     should be made even more efficient.
4376 %   \item |\@tryfcolumn| now tests if the list is empty first, otherwise
4377 %     lots of wasted time!  Thus this test has been removed from
4378 %     |\@startcolumn|.
4379 %     As Frank pointed out, this makes |\@startcolumn| less
4380 %     efficient. But it is now the same as |\@startdblcolumn|: I can
4381 %     see no reason why they should be different, but which is best?
4382 %   \item Why is |\@colroom| set in |\@doclearpage|?
4383 %   \item  Footnotes. Check what |\clearpage| does when footnotes are
4384 %     left over.  Footnotes are not put on float pages and, also,
4385 %     |\@addtonextcol| ignores the existence of held-over footnotes
4386 %     in deciding what floats can go on the page.  Not changed.
4387 %   \item  |\clearpage| can still lose non-boxes, at least when floats
4388 %     are involved.  It also moves some to the `wrong page', but this
4389 %     may be a coding problem.
4390 %   \item  The ! option makes it necessary to check in |\output| that
4391 %     there is enough room left on the page after adding a float.  (This
4392 %     would have been necessary anyway if anyone set |\@textmin| too
4393 %     close to zero!  A similar danger existed also if the text in a
4394 %     |\twocolumn[text]| entity gets too large.)
4395 %     The current implementation of this also makes the normal case a
4396 %     little less efficient, OK?
4397 %     Not enough room means, at present, less than  |\baselineskip|,
4398 %     with a warning: is this OK?  Should it be made generic (another
4399 %     parameter)?
4400 %   \item  There are four possibilities for supporting this:
4402 %     |\twocolumn[\maketitle more text]|
4404 %     One is to change
4405 %     |\maketitle| slightly to allow this.  Another is to change
4406 %     |\@topnewpage| so that more than one |\twocolumn[]| command is
4407 %     allowed; in this case |\maketitle\twocolumn[more text]| will work.
4408 %     The former is more robust from the user's viewpoint, but makes the
4409 %     code for |\maketitle| rather ad hoc (maybe it is already?).
4410 %     Another is to misuse the global twocolumn flag locally within
4411 %     |\@topnewpage|.
4412 %     Yet another is to move the column count register from the multicol
4413 %     package into the kernel.  This has been done.
4414 %   \item  Where should the reinserts be put to maximise the
4415 %     probability that footmotes come out on the correct page?
4416 %     Or should we go for as much compatibility as possible (but see
4417 %     next item)?
4418 %   \item  Should we continue to support (as much as possible)
4419 %     |\samepage|?  Some of its intended functionality is now advertised
4420 %     as being provided by |\enlargethispage|.  Use of either is likely
4421 %     to result in wrongly placed footnotes, marginals, etc.
4422 %     Which should have priority: obeying the pagination instructions,
4423 %     or correct placement of notes/marginalia?
4424 %   \item  Is the adjustment of space to cause shrinking in the
4425 %      kludge-* case correct?  Should it be limited to 0pt?
4426 %   \item  Is the setting of |\boxmaxdepth| in makecol and friends
4427 %     needed?  It only has any effect if |\@textbottom| ends with a box
4428 %     or rule, in which case the vskip to allow for its depth should
4429 %     also be added.  If it is kept, it should probably be the last
4430 %     thing in the box.  It has now been removed.
4432 %     It would perhaps be better to document that |\@textbottom|
4433 %     and |\@texttop| must have natural height 0pt.
4434 %   \item  I cannot see why the vskip adjustment for the depth
4435 %     is needed if boxmaxdepth is used to ensure that there is never
4436 %     a too deep box.
4437 %   \item  The value of |\boxmaxdepth| should be explicitly set
4438 %     whenever necessary: it is too risky to assume that it has any
4439 %     particular value.  Care is needed in deciding what to set it to.
4441 %     It is interesting to note that the value of |\boxmaxdepth| is
4442 %     unique in being read before the local settings for the box group
4443 %     are reset; all other parameter settings which affect the box
4444 %     construction use their values outside the box group.
4445 %   \item  Should |\@maxdepth| store the setting of |\maxdepth| from
4446 %     lplain?  Or should we provide a proper interface to class files
4447 %     for setting these?
4448 % \end{enumerate}
4450 % An analysis of various other macros.
4452 %    |\@opcol| should do |\@floatplacement|, but where?  Right at the
4453 %    end, since it always occurs at the start of a column.
4454 % \begin{verbatim}
4455 % \def\@opcol{%
4456 %   % Why is this done first?
4457 %   \global \@mparbottom \z@
4458 %   \if@twocolumn
4459 %     \@outputdblcol
4460 %   \else
4461 %     \@outputpage
4462 %     % This is not needed since it is done at the end of
4463 %     %   |\@outputpage|:
4464 %     \global \@colht \textheight
4465 %   \fi}
4466 % \end{verbatim}
4468 % Only tracing has been added to these.
4470 %    \begin{macrocode}
4471 %<latexrelease|fltrace>\IncludeInRelease{2017/01/01}%
4472 %<latexrelease|fltrace>  {\@makefcolumn}{negative height floats}%
4473 %<*2ekernel|fltrace|latexrelease>
4474 \def\@makefcolumn #1{%
4475   \begingroup
4476 %    \end{macrocode}
4477 % \changes{v1.3b}{2017/01/01}{make fpmin negative so ignored even if float height is negative}
4478 %    \begin{macrocode}
4479     \@fpmin -\maxdimen
4480 %    \end{macrocode}
4482 %    \begin{macrocode}
4483     \let \@testfp \@gobble
4484     \@tryfcolumn #1%
4485   \endgroup
4486 %<*trace>
4487   \if@fcolmade
4488     \fl@trace{PAGE: in \string\clearpage
4489                               \if@twocolumn ---twocolumn\fi---}%
4490     \fl@trace{----- float column/page completed from \string#1}%
4491   \fi
4492 %</trace>
4494 %    \end{macrocode}
4496 %    \begin{macrocode}
4497 %<latexrelease|fltrace>\EndIncludeInRelease
4498 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
4499 %<latexrelease|fltrace>  {\@makefcolumn}{negative height floats}%
4500 %<latexrelease|fltrace>\def\@makefcolumn #1{%
4501 %<latexrelease|fltrace>  \begingroup
4502 %<latexrelease|fltrace>    \@fpmin \z@
4503 %<latexrelease|fltrace>    \let \@testfp \@gobble
4504 %<latexrelease|fltrace>    \@tryfcolumn #1%
4505 %<latexrelease|fltrace>  \endgroup
4506 %<*trace>
4507 %<latexrelease|fltrace>  \if@fcolmade
4508 %<latexrelease|fltrace>    \fl@trace{PAGE: in \string\clearpage
4509 %<latexrelease|fltrace>                    \if@twocolumn ---twocolumn\fi---}%
4510 %<latexrelease|fltrace>    \fl@trace{----- float column/page completed
4511 %<latexrelease|fltrace>                    from \string#1}%
4512 %<latexrelease|fltrace>  \fi
4513 %</trace>
4514 %<latexrelease|fltrace>}
4515 %<latexrelease|fltrace>\EndIncludeInRelease
4516 %</2ekernel|fltrace|latexrelease>
4517 %    \end{macrocode}
4518 % This will line up the last baselines in the two
4519 % columns provided they are constructed in the normal way: \ie ending
4520 % in a skip of minus the original depth, with |\@textbottom| adding
4521 % nothing.
4523 % Thus again it is essential for |\@textbottom| to have depth 0pt.
4524 % \changes{1.2g}{2000/07/12}{Ensure that rule is in \cs{normalcolor}}
4525 % \changes{v1.2m}{2014/12/30}{Command updated (latexrelease)}
4526 %    \begin{macrocode}
4527 %<latexrelease|fltrace>\IncludeInRelease{2015/01/01}%
4528 %<latexrelease|fltrace>  {\@outputdblcol}{2 column marks}%
4529 %<*2ekernel|fltrace|latexrelease>
4530 %    \end{macrocode}
4533 % This is just a change to the single command |\@outputdblcol|
4534 % so that it saves mark information for the first column and restores
4535 % it in the second column.
4536 %    \begin{macrocode}
4537 \def\@outputdblcol{%
4538   \if@firstcolumn
4539     \global\@firstcolumnfalse
4540 %    \end{macrocode}
4541 % Save the left column
4542 %    \begin{macrocode}
4543     \global\setbox\@leftcolumn\copy\@outputbox
4544 %<fltrace>    \fl@trace{PAGE: first column boxed}%
4545 %    \end{macrocode}
4547 % Remember the marks from the first column
4548 %    \begin{macrocode}
4549     \splitmaxdepth\maxdimen
4550     \vbadness\maxdimen
4551 %    \end{macrocode}
4552 %  In case of |\enlargethispage| we will have infinite negative glue
4553 %  at the bottom of the page (coming from |\vss|) and that will earn
4554 %  us an error message if we |\vsplit| to get at the marks.  So we
4555 %  need to remove thek last glue (if any) at the end of |\@outputbox|
4556 %  as we are only interested in marks that change doesn't matter.
4557 % \changes{v1.1o}{2014/04/18}{Handle infinite glue from
4558 %  \cs{enlargethispage} (pr/4023)}
4559 %    \begin{macrocode}
4560      \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
4561      \setbox\@outputbox\vsplit\@outputbox to\maxdimen
4562 %    \end{macrocode}
4564 % One minor difference from the current |fixmarks| package, pass the
4565 % marks through a token register to stop any |#| tokens causing an
4566 % error in a |\def|.
4567 %    \begin{macrocode}
4568     \toks@\expandafter{\topmark}%
4569     \xdef\@firstcoltopmark{\the\toks@}%
4570     \toks@\expandafter{\splitfirstmark}%
4571     \xdef\@firstcolfirstmark{\the\toks@}%
4572 %    \end{macrocode}
4574 % This test does not work if truly empty marks have been inserted, but
4575 % \LaTeX\ marks should always have (at least) two brace groups.
4576 % (Except before the first mark is used, when the marks are empty,
4577 % but that is OK here.)
4578 %    \begin{macrocode}
4579     \ifx\@firstcolfirstmark\@empty
4580       \global\let\@setmarks\relax
4581     \else
4582       \gdef\@setmarks{%
4583         \let\firstmark\@firstcolfirstmark
4584         \let\topmark\@firstcoltopmark}%
4585     \fi
4586 %    \end{macrocode}
4588 % End of change
4589 %    \begin{macrocode}
4590   \else
4591     \global\@firstcolumntrue
4592     \setbox\@outputbox\vbox{%
4593      \hb@xt@\textwidth{%
4594         \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
4595         \hfil
4596 %    \end{macrocode}
4597 % \changes{v1.1m}{2006/09/13}{Ensure that rule is in \cs{normalcolor}}
4598 % The color of the \cs{vrule} should be \cs{normalcolor} as to not
4599 % inherit the color from the column.
4600 %    \begin{macrocode}
4601         {\normalcolor\vrule \@width\columnseprule}%
4602         \hfil
4603        \hb@xt@\columnwidth{\box\@outputbox \hss}}}%
4604 %<fltrace>    \fl@trace{PAGE: second column also boxed}%
4605   \@combinedblfloats
4606 %    \end{macrocode}
4607 % Override current first and top with those of first column if necessary
4608 %    \begin{macrocode}
4609     \@setmarks
4610 %    \end{macrocode}
4611 % End of change
4612 %    \begin{macrocode}
4613     \@outputpage
4614 %<fltrace>    \fl@trace{PAGE: two column page completed}%
4615     \begingroup
4616       \@dblfloatplacement
4617       \@startdblcolumn
4618       \@whilesw\if@fcolmade \fi{\@outputpage
4619 %<fltrace>      \fl@trace{PAGE: double float page completed}%
4620      \@startdblcolumn}%
4621     \endgroup
4622   \fi}%
4623 %    \end{macrocode}
4625 %    \begin{macrocode}
4626 %<latexrelease|fltrace>\EndIncludeInRelease
4627 %<latexrelease|fltrace>\IncludeInRelease{0000/00/00}%
4628 %<latexrelease|fltrace>  {\@outputdblcol}{2 column marks}%
4629 %<latexrelease|fltrace>\def\@outputdblcol{%
4630 %<latexrelease|fltrace>  \if@firstcolumn
4631 %<latexrelease|fltrace>    \global \@firstcolumnfalse
4632 %<latexrelease|fltrace>    \global \setbox\@leftcolumn \box\@outputbox
4633 %<*trace>
4634 %<latexrelease|fltrace>    \fl@trace{PAGE: first column boxed}%
4635 %</trace>
4636 %<latexrelease|fltrace>  \else
4637 %<latexrelease|fltrace>    \global \@firstcolumntrue
4638 %<latexrelease|fltrace>    \setbox\@outputbox \vbox {%
4639 %<latexrelease|fltrace>                         \hb@xt@\textwidth {%
4640 %<latexrelease|fltrace>                           \hb@xt@\columnwidth {%
4641 %<latexrelease|fltrace>                             \box\@leftcolumn \hss}%
4642 %<latexrelease|fltrace>                           \hfil
4643 %<latexrelease|fltrace>                           {\normalcolor\vrule
4644 %<latexrelease|fltrace>                               \@width\columnseprule}%
4645 %<latexrelease|fltrace>                           \hfil
4646 %<latexrelease|fltrace>                           \hb@xt@\columnwidth {%
4647 %<latexrelease|fltrace>                             \box\@outputbox \hss}%
4648 %<latexrelease|fltrace>                                             }%
4649 %<latexrelease|fltrace>                              }%
4650 %<*trace>
4651 %<latexrelease|fltrace>    \fl@trace{PAGE: second column also boxed}%
4652 %</trace>
4653 %<latexrelease|fltrace>    \@combinedblfloats
4654 %<latexrelease|fltrace>    \@outputpage
4655 %<*trace>
4656 %<latexrelease|fltrace>    \fl@trace{PAGE: two column page completed}%
4657 %</trace>
4658 %<latexrelease|fltrace>    \begingroup
4659 %<latexrelease|fltrace>      \@dblfloatplacement
4660 %<latexrelease|fltrace>      \@startdblcolumn
4661 %    \end{macrocode}
4662 %    This loop could be replaced by an |\expandafter| tail
4663 %    recursion in\\ |\@startdblcolumn|.
4664 %    \begin{macrocode}
4665 %<latexrelease|fltrace>      \@whilesw\if@fcolmade \fi
4666 %<latexrelease|fltrace>        {\@outputpage
4667 %<*trace>
4668 %<latexrelease|fltrace>      \fl@trace{PAGE: double float page completed}%
4669 %</trace>
4670 %<latexrelease|fltrace>         \@startdblcolumn}%
4671 %<latexrelease|fltrace>    \endgroup
4672 %<latexrelease|fltrace>  \fi
4673 %<latexrelease|fltrace>}%
4674 %<latexrelease|fltrace>\EndIncludeInRelease
4675 %</2ekernel|fltrace|latexrelease>
4676 %    \end{macrocode}
4678 % \subsubsection{Float placement parameters}
4679 % \changes{v1.0i}{1993/12/14}{Section added to declare all parameters}
4681 % The main purpose of this section is to ensure that all the
4682 % float-placement parameters which need to be set in a class file or
4683 % package have been declared.  It also describes their use and sets
4684 % values for them which are reasonable for typical documents using
4685 % US letter or A4 sized paper.
4687 % \paragraph{Limits for the placement of floating objects}
4689 % \begin{macro}{\c@topnumber}
4690 %    This counter holds the maximum number of
4691 %    floats that can appear at the top of a text page or column.
4692 %    \begin{macrocode}
4693 %<*2ekernel>
4694 \newcount\c@topnumber
4695 \setcounter{topnumber}{2}
4696 %    \end{macrocode}
4697 % \end{macro}
4699 % \begin{macro}{\topfraction}
4700 %    This macro holds the maximum proportion (as a decimal number) of
4701 %    a text page or column that can be occupied by floats at the top.
4702 %    \begin{macrocode}
4703 \newcommand\topfraction{.7}
4704 %    \end{macrocode}
4705 % \end{macro}
4707 % \begin{macro}{\c@bottomnumber}
4708 %    This counter holds the maximum number of
4709 %    floats that can appear at the bottom of a text page or column.
4710 %    \begin{macrocode}
4711 \newcount\c@bottomnumber
4712 \setcounter{bottomnumber}{1}
4713 %    \end{macrocode}
4714 % \end{macro}
4716 % \begin{macro}{\bottomfraction}
4717 %    This macro holds the maximum proportion (as a decimal number) of
4718 %    a text page or column that can be occupied by floats at the bottom.
4719 %    \begin{macrocode}
4720 \newcommand\bottomfraction{.3}
4721 %    \end{macrocode}
4722 % \end{macro}
4724 % \begin{macro}{\c@totalnumber}
4725 %    This counter holds the maximum number of floats that can appear on
4726 %    any text page or column.
4727 %    \begin{macrocode}
4728 \newcount\c@totalnumber
4729 \setcounter{totalnumber}{3}
4730 %    \end{macrocode}
4731 % \end{macro}
4733 % \begin{macro}{\textfraction}
4734 %    This macro holds the minimum proportion (as a decimal number) of
4735 %    a text page or column that must be occupied by text.
4736 %    \begin{macrocode}
4737 \newcommand\textfraction{.2}
4738 %    \end{macrocode}
4739 % \end{macro}
4741 % \begin{macro}{\floatpagefraction}
4742 %    This macro holds the minimum proportion (as a decimal number) of
4743 %    a page or column that must be occupied by floating objects before a
4744 %    `float page' is produced.
4745 %    \begin{macrocode}
4746 \newcommand\floatpagefraction{.5}
4747 %    \end{macrocode}
4748 % \end{macro}
4750 % \begin{macro}{\c@dbltopnumber}
4751 %    This counter holds the maximum number of double-column floats that
4752 %    can appear on the top of a two-column text page.
4753 %    \begin{macrocode}
4754 \newcount\c@dbltopnumber
4755 \setcounter{dbltopnumber}{2}
4756 %    \end{macrocode}
4757 % \end{macro}
4759 % \begin{macro}{\dbltopfraction}
4760 %    This macro holds the maximum proportion (as a decimal number) of
4761 %    a two-column text page that can be occupied by double-column floats
4762 %    at the top.
4763 %    \begin{macrocode}
4764 \newcommand\dbltopfraction{.7}
4765 %    \end{macrocode}
4766 % \end{macro}
4768 % \begin{macro}{\dblfloatpagefraction}
4769 %    This macro holds the minimum proportion (as a decimal number) of
4770 %    a page that must be occupied by double-column floating objects
4771 %    before a `double-column float page' is produced.
4772 %    \begin{macrocode}
4773 \newcommand\dblfloatpagefraction{.5}
4774 %    \end{macrocode}
4775 % \end{macro}
4777 % \paragraph{Floats on a text page}
4779 % \begin{macro}{\floatsep}
4780 % \begin{macro}{\textfloatsep}
4781 % \begin{macro}{\intextsep}
4782 %    When a floating object is placed on a page with text, these
4783 %    parameters control the separation between the float and the other
4784 %    objects on the page. These parameters are used for both
4785 %    one-column mode and single-column floats in two-column mode.
4786 %    They are all rubber lengths.
4788 %    |\floatsep| is the space between adjacent floats that are placed
4789 %    at the top or bottom of the text page or column.
4791 %    |\textfloatsep| is the space between the main text and floats
4792 %    at the top or bottom of the page or column.
4794 %    |\intextsep| is the space between in-text floats and the text.
4795 %    \begin{macrocode}
4796 \newskip\floatsep
4797 \newskip\textfloatsep
4798 \newskip\intextsep
4799 \setlength\floatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
4800 \setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
4801 \setlength\intextsep   {12\p@ \@plus 2\p@ \@minus 2\p@}
4802 %    \end{macrocode}
4803 % \end{macro}
4804 % \end{macro}
4805 % \end{macro}
4807 % \begin{macro}{\dblfloatsep}
4808 % \begin{macro}{\dbltextfloatsep}
4809 %    When double-column floats (floating objects that span the whole
4810 %    |\textwidth|) are placed at the top of a text page in two-column
4811 %    mode, the separation between the float and the text is controlled
4812 %    by |\dblfloatsep| and |\dbltextfloatsep|.  They are rubber lengths.
4814 %    |\dblfloatsep| is the space between adjacent double-column floats
4815 %    placed at the top of the text page.
4817 %    |\dbltextfloatsep| is the space between the main text and
4818 %    double-column floats at the top of the page.
4819 %    \begin{macrocode}
4820 \newskip\dblfloatsep
4821 \newskip\dbltextfloatsep
4822 \setlength\dblfloatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
4823 \setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
4824 %    \end{macrocode}
4825 % \end{macro}
4826 % \end{macro}
4828 % \paragraph{Floats on their own page or column}
4830 % \begin{macro}{\@fptop}
4831 % \begin{macro}{\@fpsep}
4832 % \begin{macro}{\@fpbot}
4833 %    When floating objects are placed on a separate page or column,
4834 %    called a `float page', the layout of the page is controlled by
4835 %    these parameters, which are rubber lengths.
4837 %    At the top of the page |\@fptop| is inserted;
4838 %    typically this supplies some stretchable whitespace.
4839 %    At the bottom of the page |\@fpbot| ais inserted.
4840 %    Between adjacent floats |\@fpsep| is inserted.
4842 %    These parameters are used for all floating objects on a
4843 %    `float page' in one-column mode, and for single-column
4844 %    floats in two-column mode.
4846 %    Note that at least one of the two parameters |\@fptop| and
4847 %    |\@fpbot| should contain a |plus ...fil| so as to fill the
4848 %    remaining empty space.
4849 %    \begin{macrocode}
4850 \newskip\@fptop
4851 \newskip\@fpsep
4852 \newskip\@fpbot
4853 \setlength\@fptop{0\p@ \@plus 1fil}
4854 \setlength\@fpsep{8\p@ \@plus 2fil}
4855 \setlength\@fpbot{0\p@ \@plus 1fil}
4856 %    \end{macrocode}
4857 % \end{macro}
4858 % \end{macro}
4859 % \end{macro}
4861 % \begin{macro}{\@dblfptop}
4862 % \begin{macro}{\@dblfpsep}
4863 % \begin{macro}{\@dblfpbot}
4864 %    Double-column `float pages' in two-column mode use similar
4865 %    parameters.
4866 %    \begin{macrocode}
4867 \newskip\@dblfptop
4868 \newskip\@dblfpsep
4869 \newskip\@dblfpbot
4870 \setlength\@dblfptop{0\p@ \@plus 1fil}
4871 \setlength\@dblfpsep{8\p@ \@plus 2fil}
4872 \setlength\@dblfpbot{0\p@ \@plus 1fil}
4873 %    \end{macrocode}
4874 % \end{macro}
4875 % \end{macro}
4876 % \end{macro}
4878 % \begin{macro}{\topfigrule}
4879 % \begin{macro}{\botfigrule}
4880 % \begin{macro}{\dblfigrule}
4881 %    The macros can be used to put in rules between floats and text;
4882 %    whatever they insert should be vertical mode material which takes
4883 %    up zero space.
4884 % \task{CAR}{Add more rules (for Frank in addtocurcol)}
4885 %    \begin{macrocode}
4886 \let\topfigrule=\relax
4887 \let\botfigrule=\relax
4888 \let\dblfigrule=\relax
4889 %</2ekernel>
4890 %    \end{macrocode}
4891 % \end{macro}
4892 % \end{macro}
4893 % \end{macro}
4896 % \Finale
4897 \endinput