1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
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
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.
30 %%% From File: ltfloat.dtx
34 \ProvidesFile{ltfloat.dtx}[2015/02/21 v1.2c LaTeX Kernel (Floats)]
36 \documentclass{ltxdoc}
37 \GetFileInfo{ltfloat.dtx}
50 \MaintainedByLaTeXTeam{latex}
61 % The different types of floats are identified by a \meta{type} name,
62 % which is the name of the counter for that kind of float. For
63 % example, figures are of type `figure' and tables are of type `table'.
64 % Each \meta{type} has associated a positive \meta{type number}, which
65 % is a power of two. E.g.,\\
66 % figures might be have type number~1, tables type number~2, programs
69 % The locations where a float can go are specified by a
70 % \meta{placement specifier}, which is a list of the possible
71 % locations, each denoted by a letter as follows:
73 % \begin{tabular}{l@{ : }l@{ --- }l}
74 % h & here & at the current location in the text.\\
75 % t & top & at the top of a text page.\\
76 % b & bottom & at the bottom of a text page.\\
77 % p & page & on a separate float page
80 % In addition, in conjunction with these, you can use `!' which means
81 % that the current values of the float positioning parameters are
82 % ignored for this float. (Has no effect on `p', float page
84 % For example, `pht' specifies that the float can appear in any of
85 % three locations: page, here or top.
90 % \changes{v1.0a}{1994/03/04}{Initial version, split from latex.dtx}
91 % \changes{v1.0b}{1994/03/28}{Split further from ltherest.dtx}
92 % \changes{v1.0e}{1994/04/25}{Changed warning messages}
93 % \changes{v1.0e}{1994/04/25}{Removed obsolete tracing code}
94 % \changes{v1.0f}{1994/05/03}
95 % {(CAR) Added \cs{@largefloatcheck}}
96 % \changes{v1.0f}{1994/05/03}{Removed unnecessary braces from
97 % arguments of \cs{@ifnextchar}}
98 % \changes{v1.0i}{1994/05/22}{Use new warning commands}
99 % \changes{v1.1e}{1994/11/17}
100 % {\cs{@tempa} to \cs{reserved@a}}
101 % \changes{v1.1g}{1994/12/10}{Some temps reinserted temporarily}
102 % \changes{v1.1n}{1995/11/28}{documentation fixes}
103 % \changes{v1.1s}{1997/06/16}{documentation fixes}
105 % \subsection{Floating Environments}
110 % \begin{oldcomments}
112 % Where floats may appear on a page, and how many may appear there
113 % are specified by the following float placement parameters. The
114 % numbers are named like counters so the user can set them with
115 % the ordinary counter-setting commands.
117 % \c@topnumber : Number of floats allowed at the top of a column.
118 % \topfraction : Fraction of column that can be devoted to floats.
119 % \c@dbltopnumber, \dbltopfraction
120 % : Same as above, but for double-column floats.
121 % \c@bottomnumber, \bottomfraction
122 % : Same as above for bottom of page.
123 % \c@totalnumber : Number of floats allowed in a single column,
124 % including in-text floats.
125 % \textfraction :Minimum fraction of column that must contain text.
126 % \floatpagefraction: Minimum fraction of page that must be taken
128 % \dblfloatpagefraction
129 % : Same as above, for double-column floats.
131 % The document style must define the following.
133 % \fps@TYPE : The default placement specifier for floats of type
136 % \ftype@TYPE : The type number for floats of type TYPE.
138 % \ext@TYPE : The file extension indicating the file on which the
139 % contents list for float type TYPE is stored.
140 % For example, \ext@figure = 'lof'.
142 % \fnum@TYPE : A macro to generate the figure number for a caption.
143 % For example, \fnum@TYPE == Figure \thefigure.
145 % \@makecaption{NUM}{TEXT} :
146 % A macro to make a caption, with NUM the value
147 % produced by \fnum@... and TEXT the text of the caption.
148 % It can assume it's in a \parbox of the appropriate width.
150 % \@float{TYPE}[PLACEMENT] : This macro begins a float environment for a
151 % single-column float of type TYPE with PLACEMENT as the placement
152 % specifier. The default value of PLACEMENT is defined by
153 % \fps@TYPE. The environment is ended by \end@float.
154 % E.g., \figure == \@float{figure}, \endfigure == \end@float.
156 % \@float{TYPE}[PLACEMENT] ==
158 % if hmode then \@bsphack
159 % \@floatpenalty := -10002
160 % else \@floatpenalty := -10003
164 % \@fps ==L PLACEMENT
165 % \@onelevel@sanitize \@fps
166 % add default PLACEMENT if at most ! in PLACEMENT == \@fpsadddefault
168 % then LaTeX Error: 'Not in outer paragraph mode.'
169 % \@floatpenalty := 0
170 % else if \@freelist nonempty
171 % then \@currbox :=L head of \@freelist
172 % \@freelist :=G tail of \@freelist
173 % \count\@currbox :=G 32*\ftype@TYPE +
174 % bits determined by PLACEMENT
175 % else \@floatpenalty := 0
176 % LaTeX Error: 'Too many unprocessed floats'
179 % \@currbox :=G \color@vbox
183 % %% removed \boxmaxdepth :=L 0pt
184 % %% that made box 0 depth because it screwed
185 % %% things up. Instead, added \vskip0pt at end
186 % \hsize = \columnwidth
193 % \refstepcounter{\@captype}
194 % \@dblarg{\@caption{\@captype}}
197 % In following definition, \par moved from after \addcontentsline to
198 % before \addcontentsline because the \write could cause
199 % an extra blank line to be added to the paragraph above the
200 % caption. (Change made 12 Jun 87)
202 % \@caption{TYPE}[STEXT]{TEXT} ==
205 % \addcontentsline{\ext@TYPE}{TYPE}{\numberline{\theTYPE}{STEXT}}
209 % \@makecaption{\fnum@TYPE}{TEXT}
215 % \@dblfloat{TYPE}[PLACEMENT] : Macro to begin a float environment for
216 % a double-column float of type TYPE with PLACEMENT as the placement
217 % specifier. The default value of PLACEMENT is 'tp'
218 % The environment is ended by \end@dblfloat.
219 % E.g., \figure* == \@dblfloat{figure},
220 % \endfigure* == \end@dblfloat.
222 % \@dblfloat{TYPE}[PLACEMENT] ==
223 % Identical to \@float{TYPE}[PLACEMENT] except \hsize and \linewidth
224 % are set to \textwidth.
227 % \begin{macro}{\@floatpenalty}
229 \newcount\@floatpenalty
233 % \begin{macro}{\caption}
235 % This is set to be an error message outside a float since no
236 % captype is defined there; this may need to be changed by some
238 % \changes{v1.1u}{1999/04/19}
239 % {Made caption an error outside a float: latex/2815}
242 \ifx\@captype\@undefined
243 \@latex@error{\noexpand\caption outside float}\@ehd
246 \refstepcounter\@captype
247 \expandafter\@firstofone
249 {\@dblarg{\@caption\@captype}}%
254 % \begin{macro}{\@caption}
255 % \changes{v1.0b}{1994/03/28}
256 % {Use \cs{normalsize} not \cs{@normalsize}}
257 % \changes{v1.1r}{1996/12/06}
258 % {Call \cs{@setminpage} if needed. latex/2318}
260 \long\def\@caption#1[#2]#3{%
262 \addcontentsline{\csname ext@#1\endcsname}{#1}%
263 {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
267 % The paragraph setting parameters are normalised at this point, however
268 % |\@parboxrestore| resets |\everypar| which is not correct in this
269 % context so |\@setminipage| is called if needed.
271 % The float mechanism, like minipage, sets the flag |@minipage| true
272 % before executing the user-supplied text. Many \LaTeX\ constructs
273 % test for this flag and do not add vertical space when it is true.
274 % The intention is that this emulates \TeX's `top of page' behaviour.
275 % The flag must be set false at the start of the first paragraph. This
276 % is achieved by a redefinition of |\everypar|, but the call to
277 % |\@parboxrestore| removes that redefinition, so it is re-inserted
278 % if needed. If the flag is already false then the |\caption| was not
279 % the first entry in the float, and so some other paragraph has already
280 % activated the special |\everypar|. In this case no further action is
291 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
296 % \begin{macro}{\@float}
297 % \begin{macro}{\@dblflset}
298 % \changes{v1.1a}{1994/10/31}{Macro added}
299 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
300 % \changes{v1.1a}{1994/10/31}
301 % {Major changes to parameter parsing, setting of local variables,
302 % etc; two-column and one-column cases merged; space hacks moved}
303 % \changes{v1.1c}{1994/11/05}
304 % {Add compatibility with old version of \cs{@xfloat}.}
305 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
311 {\edef\reserved@a{\noexpand\@xfloat{#1}[\csname fps@#1\endcsname]}%
318 % \begin{macro}{\@dblfloat}
319 % \changes{v1.1a}{1994/10/31}
320 % {Major changes since two-column and one-column cases merged}
321 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
325 \if@twocolumn\let\reserved@a\@dbflt\else\let\reserved@a\@float\fi
331 % \begin{macro}{\fps@dbl}
332 % \changes{v1.1a}{1994/10/31}{Macro added}
333 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
334 % Note that all double floats have default fps `tp'.
337 % \begin{macro}{\@setfps}
338 % \changes{v1.1a}{1994/10/31}{Macro added}
339 % \changes{v1.1c}{1994/11/05}
340 % {Add compatibility with old version of \cs{@xfloat}.}
341 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
342 % This sets the fps, dealing with error conditions by adding
347 % \begin{macro}{\@xfloat}
348 % \changes{LaTeX2e}{1993/12/05}{Command changed}
349 % \changes{LaTeX2e}{1994/01/21}{Added missing percent characters.}
350 % \changes{v1.1a}{1994/10/31}
351 % {Major changes, removing setting of local variables, space hacks
352 % etc; two-column and one-column cases merged}
353 % \changes{v1.1c}{1994/11/05}
354 % {Add compatibility with old version of \cs{@xfloat}: but the
355 % arguments, provided at exorbitant cost, are now completely
357 % \changes{v1.1f}{1994/11/21}
358 % {Missing percents reinserted after 4, 8: these are not numbers.}
359 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
360 % \changes{v1.1g}{1994/12/10}{Sanitisation added temporarily}
361 % The first part of this sets the count register that stores all
362 % the information about the type and fps of the float.
364 % We assume here that the default specifiers already contain no
367 % It may be better to store the defaults as numbers, rather than
370 % \changes{v1.1p}{1996/10/24}{Added \cs{@nodocument} to trap
371 % floats in the preamble}
374 %<latexrelease>\IncludeInRelease{2015/01/01}%
375 %<latexrelease> {\@xfloat}{Check float options}%
376 %<*2ekernel|latexrelease>
377 \def\@xfloat #1[#2]{%
381 \@onelevel@sanitize \@fps
382 \def \reserved@b {!}%
383 \ifx \reserved@b \@fps
392 \@floatpenalty -\@Mii
394 \@floatpenalty-\@Miii
397 \@parmoderr\@floatpenalty\z@
399 \@next\@currbox\@freelist
402 \expandafter \@tfor \expandafter \reserved@a
403 \expandafter :\expandafter =\@fps
406 % \changes{v1.2b}{2015/01/11}{Check for valid option (latexrelease)}
407 % Start of changes, use a nested if structure, ending in an error.
413 \advance \@tempcnta \@ne
415 \else\if \reserved@a t%
417 \else\if \reserved@a b%
419 \else\if \reserved@a p%
421 \else\if \reserved@a !%
423 \advance\@tempcnta -\sixt@@n\relax
426 \@latex@error{Unknown float option `\reserved@a'}%
427 {Option `\reserved@a' ignored and `p' used.}%
434 \@tempcntb \csname ftype@\@captype \endcsname
435 \multiply \@tempcntb \@xxxii
436 \advance \@tempcnta \@tempcntb
437 \global \count\@currbox \@tempcnta
442 % The remainder sets up the box in which the float is typeset, and
443 % the typesetting environment to be used. It is essential to have
444 % the extra box to avoid the unwanted space that would otherwise
445 % often be put at the top of the float.
447 % It ends with a hook; not sure how useful this is but it is needed
448 % at present to deal with double-column floats.
449 % \task{CAR?}{Sort out hooks}
450 % \changes{v1.0a}{1994/03/07}
451 % {(DPC) Extra group for colour}
452 % \changes{v1.0c}{1994/03/14}
453 % {(DPC) Use \cs{color@begingroup}}
454 % \changes{v1.0g}{1994/05/13}
455 % {(DPC) Use \cs{normalcolor}}
456 % \changes{v1.1a}{1994/10/31}
457 % {(DPC/CAR) Extra box added to remove colour resetting from vmode}
458 % \changes{v1.1a}{1994/10/31}{Reset hook added}
459 % \changes{v1.1c}{1994/11/05}
460 % {Use new \cs{color@hbox} concept.}
461 % \changes{v1.1f}{1994/11/21}
462 % {Changed to \cs{color@vbox} so that large floats overflow
464 % \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak}}
465 % \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage}}
466 % \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
467 % \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
469 \global \setbox\@currbox
477 %</2ekernel|latexrelease>
478 %<latexrelease>\EndIncludeInRelease
479 %<latexrelease>\IncludeInRelease{0000/00/00}%
480 %<latexrelease> {\@xfloat}{Check float options}%
481 %<latexrelease>\def\@xfloat #1[#2]{%
482 %<latexrelease> \@nodocument
483 %<latexrelease> \def \@captype {#1}%
484 %<latexrelease> \def \@fps {#2}%
485 %<latexrelease> \@onelevel@sanitize \@fps
486 %<latexrelease> \def \reserved@b {!}%
487 %<latexrelease> \ifx \reserved@b \@fps
488 %<latexrelease> \@fpsadddefault
489 %<latexrelease> \else
490 %<latexrelease> \ifx \@fps \@empty
491 %<latexrelease> \@fpsadddefault
494 %<latexrelease> \ifhmode
495 %<latexrelease> \@bsphack
496 %<latexrelease> \@floatpenalty -\@Mii
497 %<latexrelease> \else
498 %<latexrelease> \@floatpenalty-\@Miii
500 %<latexrelease> \ifinner
501 %<latexrelease> \@parmoderr\@floatpenalty\z@
502 %<latexrelease> \else
503 %<latexrelease> \@next\@currbox\@freelist
505 %<latexrelease> \@tempcnta \sixt@@n
506 %<latexrelease> \expandafter \@tfor \expandafter \reserved@a
507 %<latexrelease> \expandafter :\expandafter =\@fps
510 %<latexrelease> \if \reserved@a h%
511 %<latexrelease> \ifodd \@tempcnta
512 %<latexrelease> \else
513 %<latexrelease> \advance \@tempcnta \@ne
516 %<latexrelease> \if \reserved@a t%
517 %<latexrelease> \@setfpsbit \tw@
519 %<latexrelease> \if \reserved@a b%
520 %<latexrelease> \@setfpsbit 4%
522 %<latexrelease> \if \reserved@a p%
523 %<latexrelease> \@setfpsbit 8%
525 %<latexrelease> \if \reserved@a !%
526 %<latexrelease> \ifnum \@tempcnta>15
527 %<latexrelease> \advance\@tempcnta -\sixt@@n\relax
531 %<latexrelease> \@tempcntb \csname ftype@\@captype \endcsname
532 %<latexrelease> \multiply \@tempcntb \@xxxii
533 %<latexrelease> \advance \@tempcnta \@tempcntb
534 %<latexrelease> \global \count\@currbox \@tempcnta
536 %<latexrelease> \@fltovf
538 %<latexrelease> \global \setbox\@currbox
539 %<latexrelease> \color@vbox
540 %<latexrelease> \normalcolor
541 %<latexrelease> \vbox \bgroup
542 %<latexrelease> \hsize\columnwidth
543 %<latexrelease> \@parboxrestore
544 %<latexrelease> \@floatboxreset
546 %<latexrelease>\EndIncludeInRelease
551 % \begin{macro}{\@floatboxreset}
552 % \changes{v1.1a}{1994/10/31}{Macro added}
554 % The rational for allowing these normally global flags to be set
555 % locally here, via |\@parboxrestore|, was stated originally by
556 % Donald Arseneau and extended by Chris Rowley.
557 % It is because these flags are only set globally to
558 % true by section commands, and these should never appear within
559 % marginals or floats or, indeed, in any group; and they are only ever
560 % set globally to false when they are definitely true.
562 % If anyone is unhappy with this argument then both flags should be
563 % treated as in |\set@nobreak|; otherwise this command will be
565 % \changes{v1.1p}{1996/10/24}
566 % {Added local settings of flags: dangerous!!}
568 \def \@floatboxreset {%
576 % \begin{macro}{\@setnobreak}
577 % \changes{v1.1f}{1994/11/21}{Macro added}
578 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
583 \let\outer@nobreak\@nobreaktrue
590 % \begin{macro}{\@setminipage}
591 % \changes{v1.1f}{1994/11/21}{Macro added}
592 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
597 \everypar{\@minipagefalse\everypar{}}%
602 % \begin{macro}{\end@float}
603 % \changes{v1.0f}{1994/05/03}
604 % {(CAR) Added \cs{@largefloatcheck}}
605 % \changes{v1.1n}{1995/10/25}{(CAR) unify code for double and
610 \ifnum\@floatpenalty <\z@
612 % We make sure that we never exceed |\textheight|, otherwise float
613 % will never get typeset (91/03/15 FMi).
616 \@cons\@currlist\@currbox
617 \ifnum\@floatpenalty <-\@Mii
620 % Saving and restoring |\prevdepth| added 26 May 87 to prevent extra
621 % vertical space when used in vertical mode.
629 \penalty\@floatpenalty
631 % \changes{LaTeX2.09}{1992/03/18}
632 % {(RmS) changed \cs{@esphack} to \cs{@Esphack}}
635 \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack
642 % \begin{macro}{\end@dblfloat}
643 % \changes{v1.0f}{1994/05/03}{\cs{@largefloatcheck} added}
644 % \changes{v1.1n}{1995/10/25}{(CAR) unify code for double and
646 % \changes{v1.2b}{2015/01/11}{float order in 2-column (latexrelease)}
649 %<latexrelease>\IncludeInRelease{2015/01/01}%
650 %<latexrelease> {\end@dblfloat}{float order in 2-column}%
651 %<*2ekernel|latexrelease>
655 \ifnum\@floatpenalty <\z@
659 % Force the depth of two column float boxes.
661 \global\dp\@currbox1sp %
663 % What follows is essentially |\end@float| without a starting
665 % \changes{v1.2b}{2000/09/24}{FMi: use output routine to
667 % \changes{v1.2b}{2014/04/27}{Inline the code to allow some
668 % coexistence with packages that hook into \cs{end@float} and do not
669 % know about the algorithm change}
671 \@cons\@currlist\@currbox
672 \ifnum\@floatpenalty <-\@Mii
677 \penalty\@floatpenalty
679 \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack
682 % \changes{v1.2b}{2014/06/10}{missing \cs{fi} added}
689 %</2ekernel|latexrelease>
690 %<latexrelease>\EndIncludeInRelease
691 %<latexrelease>\IncludeInRelease{0000/00/00}%
692 %<latexrelease> {\end@dblfloat}{float order in 2-column}%
693 %<latexrelease>\def\end@dblfloat{%
694 %<latexrelease>\if@twocolumn
695 %<latexrelease> \@endfloatbox
696 %<latexrelease> \ifnum\@floatpenalty <\z@
698 % We make sure that we never exceed |\textheight|, otherwise float
699 % will never get typeset (91/03/15 FMi).
701 %<latexrelease> \@largefloatcheck
702 %<latexrelease> \@cons\@dbldeferlist\@currbox
705 % RmS 92/03/18 changed |\@esphack| to |\@Esphack|.
707 %<latexrelease> \ifnum \@floatpenalty =-\@Mii \@Esphack\fi
709 %<latexrelease> \end@float
712 %<latexrelease>\EndIncludeInRelease
717 % \begin{macro}{\@endfloatbox}
718 % \changes{v1.1n}{1995/10/25}{(CAR) macro added: to unify code for
719 % double and single versions}
720 % This macro is not intended to be a hook; it is designed to help
721 % maintain the integrity of this code, which is used twice and, as
722 % can be seen, is subject to frequent changes.
725 \par\vskip\z@skip %% \par\vskip\z@ added 15 Dec 87
728 % {1994/03/07}{(DPC) Extra group for colour}
729 % \changes{v1.0c}{1994/03/14}
730 % {(DPC) Use \cs{color@endgroup}}
731 % \changes{v1.0h}{1994/05/20}{Restore outer value of @nobreak switch.}
732 % \changes{v1.1a}{1994/10/31}
733 % {(DPC/CAR) Extra box added to remove colour resetting from vmode}
734 % \changes{v1.1c}{1994/11/05}
735 % {Use new \cs{color@hbox} concept.}
736 % \changes{v1.1f}{1994/11/21}{Corrected position of \cs{outer@nobreak}}
737 % \changes{v1.1f}{1994/11/21}{Added reset of minipage flag}
738 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
743 \egroup %% end of vbox
747 % \begin{macro}{\outer@nobreak}
748 % \changes{v1.0h}{1994/05/20}{Macro added: default is to do nothing.}
750 \let\outer@nobreak\@empty
755 % \begin{macro}{\@largefloatcheck}
756 % \changes{v1.0e}{1994/04/25}{Command added}
758 % This calculates by how much a float is oversize for the page and
759 % prints this in a warning message.
762 \def \@largefloatcheck{%
763 \ifdim \ht\@currbox>\textheight
764 \@tempdima -\textheight
765 \advance \@tempdima \ht\@currbox
767 % \changes{v1.0e}{1994/04/25}{Changed warning message to give more
770 \@latex@warning {Float too large for page by \the\@tempdima}%
771 \ht\@currbox \textheight
777 % \begin{macro}{\@dbflt}
778 % \begin{macro}{\@xdblfloat}
779 % \changes{v1.1a}{1994/10/31}
780 % {Macros removed: \cs{@dbflt}, \cs{@xdblfloat}}
781 % \changes{v1.1g}{1994/12/10}{Macros reinserted temporarily}
785 \def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[tp]}}
786 \def\@xdblfloat#1[#2]{%
787 \@xfloat{#1}[#2]\hsize\textwidth\linewidth\textwidth}
793 % Moved to ltoutput 93/12/16
795 %\newcount\c@topnumber
796 %\newcount\c@dbltopnumber
797 %\newcount\c@bottomnumber
798 %\newcount\c@totalnumber
801 % \begin{macro}{\@dblfloatplacement}
802 % An analysis of |\@floatplacement|:
804 % This should be called whenever |\@colht| has been set.
806 \def\@floatplacement{\global\@topnum\c@topnumber
807 % Textpage bit, global:
808 \global\@toproom \topfraction\@colht
809 \global\@botnum \c@bottomnumber
810 \global\@botroom \bottomfraction\@colht
811 \global\@colnum \c@totalnumber
812 % Floatpage bit, local:
813 \@fpmin \floatpagefraction\@colht}
818 % \begin{macro}{\@dblfloatplacement}
819 % \changes{LaTeX2e}{1993/12/05}{Command changed}
821 % This should be called only within a group. Now changed to
822 % provide extra checks in |\@addtodblcol|, needed when processing a
825 % \changes{v1.2b}{2015/01/11}{float order in 2-column (latexrelease)}
827 %<latexrelease>\IncludeInRelease{2015/01/01}%
828 %<latexrelease> {\@dblfloatplacement}{float order in 2-column}%
829 %<*2ekernel|latexrelease>
831 % When making two column float area, look for floats with 1sp
834 \def\@dblfloatplacement{\global\@dbltopnum\c@dbltopnumber
835 \global\@dbltoproom \dbltopfraction\@colht
837 \advance \@textmin -\@dbltoproom
838 \@fpmin \dblfloatpagefraction\textheight
843 % |\f@depth| is used in |\@testwrongwidth| to look for either
844 % column or dbl-column floats. A value of |1sp| signals the
845 % latter. Because of this setting here, |\@dblfloatplacment| needs to
846 % be called inside a group which is a questionable design.
852 %</2ekernel|latexrelease>
853 %<latexrelease>\EndIncludeInRelease
854 %<latexrelease>\IncludeInRelease{0000/00/00}%
855 %<latexrelease> {\@dblfloatplacement}{float order in 2-column}%
856 %<latexrelease>\def \@dblfloatplacement {%
858 % Textpage bit: global, but need not be.
860 %<latexrelease> \global \@dbltopnum \c@dbltopnumber
861 %<latexrelease> \global \@dbltoproom \dbltopfraction\@colht
863 % This new bit uses |\@textmin| to locally store the amount of extra
864 % room in the column.
866 %<latexrelease> \@textmin \@colht
867 %<latexrelease> \advance \@textmin -\@dbltoproom
869 % Floatpage bit: must be local.
871 %<latexrelease> \@fpmin \dblfloatpagefraction\textheight
872 %<latexrelease> \@fptop \@dblfptop
873 %<latexrelease> \@fpsep \@dblfpsep
874 %<latexrelease> \@fpbot \@dblfpbot
876 %<latexrelease>\EndIncludeInRelease
882 % \begin{oldcomments}
885 % Marginal notes use the same mechanism as floats to communicate
886 % with the \output routine. Marginal notes are distinguished from
887 % floats by having a negative placement specification. The command
888 % \marginpar [LTEXT]{RTEXT} generates a marginal note in a parbox,
889 % using LTEXT if it's on the left and RTEXT if it's on the right.
890 % (Default is RTEXT = LTEXT.) It uses the following parameters.
892 % \marginparwidth : Width of marginal notes.
893 % \marginparsep : Distance between marginal note and text.
894 % the page layout to determine how to move the marginal
895 % note into the margin. E.g., \@leftmarginskip ==
896 % \hskip -\marginparwidth \hskip -\marginparsep .
897 % \marginparpush : Minimum vertical separation between \marginpar's
899 % Marginal notes are normally put on the outside of the page
900 % if @mparswitch = true, and on the right if @mparswitch = false.
901 % The command \reversemarginpar reverses the side where they
902 % are put. \normalmarginpar undoes \reversemarginpar.
903 % These commands have no effect for two-column output.
905 % SURPRISE: if two marginal notes appear on the same line of
906 % text, then the second one could appear on the next page, in
910 % \marginpar [LTEXT]{RTEXT} ==
912 % if hmode then \@bsphack
913 % \@floatpenalty := -10002
914 % else \@floatpenalty := -10003
917 % then LaTeX Error: 'Not in outer paragraph mode.'
918 % \@floatpenalty := 0
919 % else if \@freelist has two elements:
920 % then get \@marbox, \@currbox from \@freelist
921 % \count\@marbox :=G -1
922 % else \@floatpenalty := 0
923 % LaTeX Error: 'Too many unprocessed floats'
924 % \@currbox, \@marbox := \@tempboxa %%use \def
927 % if optional argument
929 % \@savemarbox\@marbox{LTEXT}
930 % \@savemarbox\@currbox{RTEXT}
932 % \@savemarbox\@marbox{RTEXT}
933 % \box\@currbox :=G \box\@marbox
938 % \reversemarginpar == BEGIN \@mparbottom :=G 0
939 % @reversemargin :=G true
942 % \normalmarginpar == BEGIN \@mparbottom :=G 0
943 % @reversemargin :=G false
948 % \begin{macro}{\marginpar}
953 \@floatpenalty -\@Mii
955 \@floatpenalty-\@Miii
961 \@next\@currbox\@freelist{}{}%
962 \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
964 \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
966 \@ifnextchar [\@xmpar\@ympar}
970 % \begin{macro}{\@xmpar}
972 \long\def\@xmpar[#1]#2{%
973 \@savemarbox\@marbox{#1}%
974 \@savemarbox\@currbox{#2}%
979 % \begin{macro}{\@ympar}
982 \@savemarbox\@marbox{#1}%
983 \global\setbox\@currbox\copy\@marbox
988 % \begin{macro}{\@savemarbox}
989 % \changes{v1.0b}{1994/03/12}
990 % {(DPC) Extra group for colour}
991 % \changes{v1.0c}{1994/03/14}
992 % {(DPC) Use \cs{color@begingroup}}
993 % \changes{v1.0d}{1994/04/18}
994 % {(DPC) Remove Colour support}
995 % \changes{v1.1a}{1994/10/31}
996 % {(DPC/CAR) Extra box added for colour}
997 % \changes{v1.1c}{1994/11/05}
998 % {Use new \cs{color@hbox} concept.}
999 % \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
1000 % \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak} etc}
1001 % \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage} etc}
1002 % \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
1003 % \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
1004 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
1005 % \cs{@minipage...}}
1007 \long\def \@savemarbox #1#2{%
1011 \hsize\marginparwidth
1023 % \begin{macro}{\@marginparreset}
1024 % \changes{v1.1f}{1994/11/21}{Macro added}
1026 % The rational for allowing these normally global flags to be set
1027 % locally here, via |\@parboxrestore| was stated originally by
1028 % Donald Arsenau and extended by Chris Rowley.
1029 % It is because these flags are only set globally to
1030 % true by section commands, and these should never appear within
1031 % marginals or floats or, indeed, in any group; and they are only ever
1032 % set globally to false when they are definitely true.
1034 % If anyone is unhappy with this argument then both flags should be
1035 % treated as in |\set@nobreak|; otherwise this command will be
1037 % \changes{v1.1p}{1996/10/24}
1038 % {Added local settings of flags: dangerous!!}
1040 \def \@marginparreset {%
1043 % \let\if@nobreak\iffalse
1044 % \let\if@noskipsec\iffalse
1051 % \begin{macro}{\@xympar}
1054 % \changes{LaTeX2.09}{1992/03/18}
1055 % {(RmS) added \cs{global}\cs{@ignorefalse}}
1056 % \changes{v1.0b}{1994/03/12}
1057 % {(DPC) Extra bgroup for colour}
1058 % \changes{1.0c}{1994/03/14}
1059 % {(DPC) Use \cs{color@begingroup}}
1060 % \changes{v1.1a}{1994/10/31}
1061 % {(DPC/CAR) Extra box added since needed for floats}
1062 % \changes{v1.1c}{1994/11/05}
1063 % {Use new \cs{color@hbox} concept.}
1064 % \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
1065 % Setting the box here is done only because the code
1066 % uses \cs{end@float}; it will be empty and gets discarded.
1067 % \changes{v1.1o}{1996/08/02}{Remove \cs{global} before \cs{@ignore...}}
1070 \ifnum\@floatpenalty <\z@\@cons\@currlist\@marbox\fi
1081 % \begin{macro}{\reversemarginpar}
1082 % \begin{macro}{\normalmarginpar}
1084 \def\reversemarginpar{\global\@mparbottom\z@ \@reversemargintrue}
1085 \def\normalmarginpar{\global\@mparbottom\z@ \@reversemarginfalse}
1091 \message{footnotes,}
1094 % \subsection{Footnotes}
1096 % \begin{oldcomments}
1098 % \footnote{NOTE} : User command to insert a footnote.
1100 % \footnote[NUM]{NOTE}: User command to insert a footnote numbered
1101 % NUM, where NUM is a number -- 1, 2,
1102 % etc. For example, if footnotes are numbered
1103 % *, **, etc. within pages, then \footnote[2]{...}
1104 % produces footnote '**'. This command does not
1105 % step the footnote counter.
1107 % \footnotemark[NUM] : Command to produce just the footnote mark in
1108 % the text, but no footnote. With no argument,
1109 % it steps the footnote counter before generating
1112 % \footnotetext[NUM]{TEXT} : Command to produce the footnote but
1113 % no mark. \footnote is equivalent to
1114 % \footnotemark \footnotetext .
1116 % As in PLAIN, footnotes use \insert\footins, and the following
1119 % \footnotesize : Size-changing command for footnotes.
1121 % \footnotesep : The height of a strut placed at the beginning of
1123 % \skip\footins : Space between main text and footnotes. The rule
1124 % separating footnotes from text occurs in this
1125 % space. This space lies above the strut of height
1126 % \footnotesep which is at the beginning of the
1128 % \footnoterule : Macro to draw the rule separating footnotes from
1129 % text. It is executed right after a \vspace of
1130 % \skip\footins. It should take zero vertical
1131 % space--i.e., it should to a negative skip to
1132 % compensate for any positive space it occupies.
1135 % \interfootnotelinepenalty : Interline penalty for footnotes.
1137 % \thefootnote : In usual LaTeX style, produces the footnote number.
1138 % If footnotes are to be numbered within pages, then
1139 % the document style file must include an \@addtoreset
1140 % command to cause the footnote counter to be reset
1141 % when the page counter is stepped. This is not a good
1142 % idea, though, because the counter will not always be
1143 % reset in time to ensure that the first footnote on a
1144 % page is footnote number one.
1146 % \@thefnmark : Holds the current footnote's mark--e.g., \dag or '1'
1149 % \@mpfnnumber : A macro that generates the numbers for \footnote
1150 % and \footnotemark commands. It == \thefootnote
1151 % outside a minipage environment, but can be
1152 % changed inside to generate numbers for
1155 % \@makefnmark : A macro to generate the footnote marker from
1156 % \@thefnmark The default definition was
1157 % \hbox{$^\@thefnmark$}.
1159 % This is now replaced by
1160 % \textsuperscript{\@thefnmark}
1162 % \@makefntext{NOTE} :
1163 % Must produce the actual footnote, using \@thefnmark as the mark
1164 % of the footnote and NOTE as the text. It is called when
1165 % effectively inside a \parbox, with \hsize = \columnwidth.
1166 % For example, it might be as simple as
1167 % $^{\@thefnmark}$ NOTE
1169 % In a minipage environment, \footnote and \footnotetext are redefined
1171 % (a) they use the counter mpfootnote
1172 % (b) the footnotes they produce go at the bottom of the minipage.
1173 % The switch is accomplished by letting \@mpfn == footnote or mpfootnote
1174 % and \thempfn == \thefootnote or \thempfootnote, and by redefining
1175 % \@footnotetext to be \@mpfootnotetext in the minipage.
1177 % \footnote{NOTE} ==
1179 % \stepcounter{\@mpfn}
1181 % \protect == \noexpand
1182 % \@thefnmark :=G eval (\thempfn)
1185 % \@footnotetext{NOTE}
1188 % \footnote[NUM]{NOTE} ==
1191 % \protect == \noexpand
1192 % counter \@mpfn :=L NUM
1193 % \@thefnmark :=G eval (\thempfn)
1196 % \@footnotetext{NOTE}
1200 % BEGIN \stepcounter{footnote}
1202 % \protect == \noexpand
1203 % \@thefnmark :=G eval(\thefootnote)
1208 % \footnotemark[NUM] ==
1211 % footnote counter :=L NUM
1212 % \protect == \noexpand
1213 % \@thefnmark :=G eval(\thefootnote)
1221 % IF hmode THEN \@x@sf := \the\spacefactor FI
1222 % \@makefnmark % put number in main text
1223 % IF hmode THEN \spacefactor := \@x@sf FI
1227 % BEGIN begingroup \protect == \noexpand
1228 % \@thefnmark :=G eval (\thempfn)
1233 % \footnotetext[NUM] ==
1234 % BEGIN begingroup counter \@mpfn :=L NUM
1235 % \protect == \noexpand
1236 % \@thefnmark :=G eval (\thempfn)
1244 % \changes{v1.1l}{1995/05/24}{Moved definition of \cs{footins}
1245 % and \cs{footnoterule} from ltplain.}
1247 % \begin{macro}{\footins}
1248 % \LaTeX\ does use the same insert for footnotes as PLAIN.
1253 % \LaTeX\ leaves these initializations for the |\footins| insert.
1256 \skip\footins=\bigskipamount % space added when footnote is present
1257 \count\footins=1000 % footnote magnification factor (1 to 1)
1258 \dimen\footins=8in % maximum footnotes per page
1263 % \begin{macro}{\footnoterule}
1264 % \LaTeX\ keeps PLAIN \TeX's |\footnoterule| as the default.
1267 \def\footnoterule{\kern-3\p@
1268 \hrule \@width 2in \kern 2.6\p@} % the \hrule is .4pt high
1272 % \begin{macro}{\thefootnote}
1273 % \changes{v1.1i}{1995/05/16}{Streamlined parts of code.}
1275 \@definecounter{footnote}
1276 \def\thefootnote{\@arabic\c@footnote}
1280 % \begin{macro}{\thempfootnote}
1281 % \changes{v1.1j}{1995/05/18}{Added \cs{itshape}.}
1282 % \changes{v1.1v}{2002/10/01}{Use braces around \cs{itshape}
1283 % to keep font change local (pr/3460).}
1284 % The default display for the footnote counter in minipages is to
1285 % use italic letters. We use |\itshape| not |\textit| as the latter
1286 % would add an italic correction.
1288 \@definecounter{mpfootnote}
1289 \def\thempfootnote{{\itshape\@alph\c@mpfootnote}}
1293 % \begin{macro}{\@makefnmark}
1294 % \changes{v1.1i}{1995/05/16}{Now use \cs{textsuperscript}.}
1295 % \changes{v1.1j}{1995/05/18}{Added \cs{normalfont}.}
1296 % \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} to
1297 % \cs{textsuperscript}}
1298 % \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} back
1299 % and use \cs{@textsuperscript}}
1300 % Default definition.
1302 %\def\@makefnmark{\hbox{$^{\@thefnmark}\m@th$}}
1303 \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}}
1307 % \begin{macro}{\textsuperscript}
1308 % \changes{v1.1i}{1995/05/16}{Command added./pr1503}
1309 % \changes{v1.1k}{1995/05/20}{Use \cs{normalfont}.}
1310 % \changes{v1.1l}{1995/05/24}{Use \cs{@textsuperscript}}
1311 % This command provides superscript characters in the current text
1312 % font. It's implementation might change!!!
1314 \DeclareRobustCommand*\textsuperscript[1]{%
1315 \@textsuperscript{\selectfont#1}}
1319 % \begin{macro}{\@textsuperscript}
1320 % \changes{v1.1l}{1995/05/24}{Command added.}
1321 % \changes{v1.1n}{1995/12/05}{Use \cs{ensuremath} for latex/1984.}
1322 % \changes{v1.1m}{1995/12/07}
1323 % {Move \cs{m@th} out of the \cs{ensuremath} for latex/1984.}
1324 % This command should not be used directly, but may be used to define
1325 % other commands |\textsuperscript|, |\@makefnmark|. |#1| should
1326 % always start with a font selection command, to activate the font
1329 \def\@textsuperscript#1{%
1330 {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}
1334 % \begin{macro}{\textsubscript}
1335 % \changes{v1.2a}{2014/12/30}{Command added (latexrelease)}
1338 %<latexrelease>\IncludeInRelease{2015/01/01}%
1339 %<latexrelease> {\textsubscript}{\textsubscript}%
1340 %<*2ekernel|latexrelease>
1344 \DeclareRobustCommand*\textsubscript[1]{%
1345 \@textsubscript{\selectfont#1}}%
1349 % \begin{macro}{\@textsubscript}
1350 % \changes{v1.2a}{2014/12/30}{Command added (latexrelease)}
1353 \def\@textsubscript#1{%
1354 {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}%
1359 %</2ekernel|latexrelease>
1360 %<latexrelease>\EndIncludeInRelease
1361 %<latexrelease>\IncludeInRelease{0000/00/00}%
1362 %<latexrelease> {\textsubscript}{\textsubscript}%
1363 %<latexrelease>\let\textsubscript\@undefined
1364 %<latexrelease>\let\@textsubscript\@undefined
1365 %<latexrelease>\EndIncludeInRelease
1370 \def\@textsubscript#1{%
1371 {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
1374 % \begin{macro}{\footnotesep}
1376 \newdimen\footnotesep
1381 % \begin{macro}{\footnote}
1382 % \changes{LaTeX2.09}{1991/11/01}
1383 % {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
1384 % \cs{footnote}, \cs{footnotemark},
1385 % and \cs{footnotetext}, since \cs{xdef} is used}
1386 % \changes{LaTeX2.09}{1991/11/22}
1387 % {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
1388 % \cs{@xfootnote}, \cs{@xfootnotemark},
1389 % and \cs{@xfootnotetext}}
1390 % \changes{LaTeX2.09}{1992/11/26}
1391 % {(RmS) Changed all to
1392 % `def`protect\string{`noexpand`protect`noexpand\string}}
1393 % \changes{v1.1b}{1994/11/26}
1394 % {(ASAJ) Added \cs{protected@xdef}.}
1397 \def\footnote{\@ifnextchar[\@xfootnote{\stepcounter\@mpfn
1398 \protected@xdef\@thefnmark{\thempfn}%
1399 \@footnotemark\@footnotetext}}
1403 % \begin{macro}{\@xfootnote}
1405 \def\@xfootnote[#1]{%
1407 \csname c@\@mpfn\endcsname #1\relax
1408 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1410 \@footnotemark\@footnotetext}
1414 % \begin{macro}{\@footnotetext}
1415 % \changes{LaTeX2.09}{1991/09/29}
1416 % {(RmS) added \cs{reset@font}}
1417 % \changes{LaTeX2.09}{1992/11/26}
1418 % {(RmS) added protection for \cs{edef}}
1419 % \changes{v1.0a}{1994/03/07}
1420 % {(DPC) Extra group for colour}
1421 % \changes{v1.0c}{1994/03/14}
1422 % {(DPC) Use \cs{color@begingroup}, add \cs{endgraf}}
1423 % \changes{v1.0d}{1994/04/18}
1424 % {(DPC) Remove Colour support}
1425 % \changes{v1.0g}{1994/05/13}
1426 % {(DPC) Add new style colour support: \cs{normalcolor}}
1427 % \changes{v1.0g}{1994/05/13}
1428 % {(DPC) Use \cs{@finalstrut}}
1429 % \changes{v1.1a}{1994/10/31}
1430 % {(DPC/CAR) Move colour setting to output routine}
1431 % \changes{v1.1b}{1994/11/04}
1432 % {(ASAJ) Added \cs{protected@edef}.}
1433 % \changes{v1.1c}{1994/11/05}
1434 % {Removed \cs{normalcolor} (again)}
1435 % \changes{v1.1t}{1997/11/19}
1436 % {Missing percent, again}
1438 \long\def\@footnotetext#1{\insert\footins{%
1439 \reset@font\footnotesize
1440 \interlinepenalty\interfootnotelinepenalty
1441 \splittopskip\footnotesep
1442 \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
1443 \hsize\columnwidth \@parboxrestore
1444 \protected@edef\@currentlabel{%
1445 \csname p@footnote\endcsname\@thefnmark
1449 \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1454 % \begin{macro}{\footnotemark}
1455 % \changes{v1.1b}{1994/11/04}{Added \cs{protected@xdef} to
1456 % \cs{footnotemark}.}
1459 \@ifnextchar[\@xfootnotemark
1460 {\stepcounter{footnote}%
1461 \protected@xdef\@thefnmark{\thefootnote}%
1466 % \begin{macro}{\@xfootnotemark}
1468 \def\@xfootnotemark[#1]{%
1470 \c@footnote #1\relax
1471 \unrestored@protected@xdef\@thefnmark{\thefootnote}%
1477 % \begin{macro}{\@footnotemark}
1478 % \changes{v1.1h}{1995/05/12}
1479 % {Add \cs{nobreak} to allow hyphenation. latex/1605}
1481 \def\@footnotemark{%
1483 \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
1485 \ifhmode\spacefactor\@x@sf\fi
1490 % \begin{macro}{\footnotetext}
1493 \@ifnextchar [\@xfootnotenext
1494 {\protected@xdef\@thefnmark{\thempfn}%
1499 % \begin{macro}{\@xfootnotenext}
1501 \def\@xfootnotenext[#1]{%
1503 \csname c@\@mpfn\endcsname #1\relax
1504 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1510 % \begin{macro}{\thempfn}
1511 % \begin{macro}{\@mpfn}
1513 \def\@mpfn{footnote}
1514 \def\thempfn{\thefootnote}