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}
60 % The different types of floats are identified by a \meta{type} name,
61 % which is the name of the counter for that kind of float. For
62 % example, figures are of type `figure' and tables are of type `table'.
63 % Each \meta{type} has associated a positive \meta{type number}, which
64 % is a power of two. E.g.,\\
65 % figures might be have type number~1, tables type number~2, programs
68 % The locations where a float can go are specified by a
69 % \meta{placement specifier}, which is a list of the possible
70 % locations, each denoted by a letter as follows:
72 % \begin{tabular}{l@{ : }l@{ --- }l}
73 % h & here & at the current location in the text.\\
74 % t & top & at the top of a text page.\\
75 % b & bottom & at the bottom of a text page.\\
76 % p & page & on a separate float page
79 % In addition, in conjunction with these, you can use `!' which means
80 % that the current values of the float positioning parameters are
81 % ignored for this float. (Has no effect on `p', float page
83 % For example, `pht' specifies that the float can appear in any of
84 % three locations: page, here or top.
89 % \changes{v1.0a}{1994/03/04}{Initial version, split from latex.dtx}
90 % \changes{v1.0b}{1994/03/28}{Split further from ltherest.dtx}
91 % \changes{v1.0e}{1994/04/25}{Changed warning messages}
92 % \changes{v1.0e}{1994/04/25}{Removed obsolete tracing code}
93 % \changes{v1.0f}{1994/05/03}
94 % {(CAR) Added \cs{@largefloatcheck}}
95 % \changes{v1.0f}{1994/05/03}{Removed unnecessary braces from
96 % arguments of \cs{@ifnextchar}}
97 % \changes{v1.0i}{1994/05/22}{Use new warning commands}
98 % \changes{v1.1e}{1994/11/17}
99 % {\cs{@tempa} to \cs{reserved@a}}
100 % \changes{v1.1g}{1994/12/10}{Some temps reinserted temporarily}
101 % \changes{v1.1n}{1995/11/28}{documentation fixes}
102 % \changes{v1.1s}{1997/06/16}{documentation fixes}
104 % \subsection{Floating Environments}
109 % \begin{oldcomments}
111 % Where floats may appear on a page, and how many may appear there
112 % are specified by the following float placement parameters. The
113 % numbers are named like counters so the user can set them with
114 % the ordinary counter-setting commands.
116 % \c@topnumber : Number of floats allowed at the top of a column.
117 % \topfraction : Fraction of column that can be devoted to floats.
118 % \c@dbltopnumber, \dbltopfraction
119 % : Same as above, but for double-column floats.
120 % \c@bottomnumber, \bottomfraction
121 % : Same as above for bottom of page.
122 % \c@totalnumber : Number of floats allowed in a single column,
123 % including in-text floats.
124 % \textfraction :Minimum fraction of column that must contain text.
125 % \floatpagefraction: Minimum fraction of page that must be taken
127 % \dblfloatpagefraction
128 % : Same as above, for double-column floats.
130 % The document style must define the following.
132 % \fps@TYPE : The default placement specifier for floats of type
135 % \ftype@TYPE : The type number for floats of type TYPE.
137 % \ext@TYPE : The file extension indicating the file on which the
138 % contents list for float type TYPE is stored.
139 % For example, \ext@figure = 'lof'.
141 % \fnum@TYPE : A macro to generate the figure number for a caption.
142 % For example, \fnum@TYPE == Figure \thefigure.
144 % \@makecaption{NUM}{TEXT} :
145 % A macro to make a caption, with NUM the value
146 % produced by \fnum@... and TEXT the text of the caption.
147 % It can assume it's in a \parbox of the appropriate width.
149 % \@float{TYPE}[PLACEMENT] : This macro begins a float environment for a
150 % single-column float of type TYPE with PLACEMENT as the placement
151 % specifier. The default value of PLACEMENT is defined by
152 % \fps@TYPE. The environment is ended by \end@float.
153 % E.g., \figure == \@float{figure}, \endfigure == \end@float.
155 % \@float{TYPE}[PLACEMENT] ==
157 % if hmode then \@bsphack
158 % \@floatpenalty := -10002
159 % else \@floatpenalty := -10003
163 % \@fps ==L PLACEMENT
164 % \@onelevel@sanitize \@fps
165 % add default PLACEMENT if at most ! in PLACEMENT == \@fpsadddefault
167 % then LaTeX Error: 'Not in outer paragraph mode.'
168 % \@floatpenalty := 0
169 % else if \@freelist nonempty
170 % then \@currbox :=L head of \@freelist
171 % \@freelist :=G tail of \@freelist
172 % \count\@currbox :=G 32*\ftype@TYPE +
173 % bits determined by PLACEMENT
174 % else \@floatpenalty := 0
175 % LaTeX Error: 'Too many unprocessed floats'
178 % \@currbox :=G \color@vbox
182 % %% removed \boxmaxdepth :=L 0pt
183 % %% that made box 0 depth because it screwed
184 % %% things up. Instead, added \vskip0pt at end
185 % \hsize = \columnwidth
192 % \refstepcounter{\@captype}
193 % \@dblarg{\@caption{\@captype}}
196 % In following definition, \par moved from after \addcontentsline to
197 % before \addcontentsline because the \write could cause
198 % an extra blank line to be added to the paragraph above the
199 % caption. (Change made 12 Jun 87)
201 % \@caption{TYPE}[STEXT]{TEXT} ==
204 % \addcontentsline{\ext@TYPE}{TYPE}{\numberline{\theTYPE}{STEXT}}
208 % \@makecaption{\fnum@TYPE}{TEXT}
214 % \@dblfloat{TYPE}[PLACEMENT] : Macro to begin a float environment for
215 % a double-column float of type TYPE with PLACEMENT as the placement
216 % specifier. The default value of PLACEMENT is 'tp'
217 % The environment is ended by \end@dblfloat.
218 % E.g., \figure* == \@dblfloat{figure},
219 % \endfigure* == \end@dblfloat.
221 % \@dblfloat{TYPE}[PLACEMENT] ==
222 % Identical to \@float{TYPE}[PLACEMENT] except \hsize and \linewidth
223 % are set to \textwidth.
226 % \begin{macro}{\@floatpenalty}
228 \newcount\@floatpenalty
232 % \begin{macro}{\caption}
234 % This is set to be an error message outside a float since no
235 % captype is defined there; this may need to be changed by some
237 % \changes{v1.1u}{1999/04/19}
238 % {Made caption an error outside a float: latex/2815}
241 \ifx\@captype\@undefined
242 \@latex@error{\noexpand\caption outside float}\@ehd
245 \refstepcounter\@captype
246 \expandafter\@firstofone
248 {\@dblarg{\@caption\@captype}}%
253 % \begin{macro}{\@caption}
254 % \changes{v1.0b}{1994/03/28}
255 % {Use \cs{normalsize} not \cs{@normalsize}}
256 % \changes{v1.1r}{1996/12/06}
257 % {Call \cs{@setminpage} if needed. latex/2318}
259 \long\def\@caption#1[#2]#3{%
261 \addcontentsline{\csname ext@#1\endcsname}{#1}%
262 {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
266 % The paragraph setting parameters are normalised at this point, however
267 % |\@parboxrestore| resets |\everypar| which is not correct in this
268 % context so |\@setminipage| is called if needed.
270 % The float mechanism, like minipage, sets the flag |@minipage| true
271 % before executing the user-supplied text. Many \LaTeX\ constructs
272 % test for this flag and do not add vertical space when it is true.
273 % The intention is that this emulates \TeX's `top of page' behaviour.
274 % The flag must be set false at the start of the first paragraph. This
275 % is achieved by a redefinition of |\everypar|, but the call to
276 % |\@parboxrestore| removes that redefinition, so it is re-inserted
277 % if needed. If the flag is already false then the |\caption| was not
278 % the first entry in the float, and so some other paragraph has already
279 % activated the special |\everypar|. In this case no further action is
290 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
295 % \begin{macro}{\@float}
296 % \begin{macro}{\@dblflset}
297 % \changes{v1.1a}{1994/10/31}{Macro added}
298 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
299 % \changes{v1.1a}{1994/10/31}
300 % {Major changes to parameter parsing, setting of local variables,
301 % etc; two-column and one-column cases merged; space hacks moved}
302 % \changes{v1.1c}{1994/11/05}
303 % {Add compatibility with old version of \cs{@xfloat}.}
304 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
310 {\edef\reserved@a{\noexpand\@xfloat{#1}[\csname fps@#1\endcsname]}%
317 % \begin{macro}{\@dblfloat}
318 % \changes{v1.1a}{1994/10/31}
319 % {Major changes since two-column and one-column cases merged}
320 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
324 \if@twocolumn\let\reserved@a\@dbflt\else\let\reserved@a\@float\fi
330 % \begin{macro}{\fps@dbl}
331 % \changes{v1.1a}{1994/10/31}{Macro added}
332 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
333 % Note that all double floats have default fps `tp'.
336 % \begin{macro}{\@setfps}
337 % \changes{v1.1a}{1994/10/31}{Macro added}
338 % \changes{v1.1c}{1994/11/05}
339 % {Add compatibility with old version of \cs{@xfloat}.}
340 % \changes{v1.1g}{1994/12/10}{Macro removed temporarily}
341 % This sets the fps, dealing with error conditions by adding
346 % \begin{macro}{\@xfloat}
347 % \changes{LaTeX2e}{1993/12/05}{Command changed}
348 % \changes{LaTeX2e}{1994/01/21}{Added missing percent characters.}
349 % \changes{v1.1a}{1994/10/31}
350 % {Major changes, removing setting of local variables, space hacks
351 % etc; two-column and one-column cases merged}
352 % \changes{v1.1c}{1994/11/05}
353 % {Add compatibility with old version of \cs{@xfloat}: but the
354 % arguments, provided at exorbitant cost, are now completely
356 % \changes{v1.1f}{1994/11/21}
357 % {Missing percents reinserted after 4, 8: these are not numbers.}
358 % \changes{v1.1g}{1994/12/10}{Old version reinstated temporarily}
359 % \changes{v1.1g}{1994/12/10}{Sanitisation added temporarily}
360 % The first part of this sets the count register that stores all
361 % the information about the type and fps of the float.
363 % We assume here that the default specifiers already contain no
366 % It may be better to store the defaults as numbers, rather than
369 % \changes{v1.1p}{1996/10/24}{Added \cs{@nodocument} to trap
370 % floats in the preamble}
373 %<latexrelease>\IncludeInRelease{2015/01/01}%
374 %<latexrelease> {\@xfloat}{Check float options}%
375 %<*2ekernel|latexrelease>
376 \def\@xfloat #1[#2]{%
380 \@onelevel@sanitize \@fps
381 \def \reserved@b {!}%
382 \ifx \reserved@b \@fps
391 \@floatpenalty -\@Mii
393 \@floatpenalty-\@Miii
396 \@parmoderr\@floatpenalty\z@
398 \@next\@currbox\@freelist
401 \expandafter \@tfor \expandafter \reserved@a
402 \expandafter :\expandafter =\@fps
405 % \changes{v1.2b}{2015/01/11}{Check for valid option (latexrelease)}
406 % Start of changes, use a nested if structure, ending in an error.
412 \advance \@tempcnta \@ne
414 \else\if \reserved@a t%
416 \else\if \reserved@a b%
418 \else\if \reserved@a p%
420 \else\if \reserved@a !%
422 \advance\@tempcnta -\sixt@@n\relax
425 \@latex@error{Unknown float option `\reserved@a'}%
426 {Option `\reserved@a' ignored and `p' used.}%
433 \@tempcntb \csname ftype@\@captype \endcsname
434 \multiply \@tempcntb \@xxxii
435 \advance \@tempcnta \@tempcntb
436 \global \count\@currbox \@tempcnta
441 % The remainder sets up the box in which the float is typeset, and
442 % the typesetting environment to be used. It is essential to have
443 % the extra box to avoid the unwanted space that would otherwise
444 % often be put at the top of the float.
446 % It ends with a hook; not sure how useful this is but it is needed
447 % at present to deal with double-column floats.
448 % \task{CAR?}{Sort out hooks}
449 % \changes{v1.0a}{1994/03/07}
450 % {(DPC) Extra group for colour}
451 % \changes{v1.0c}{1994/03/14}
452 % {(DPC) Use \cs{color@begingroup}}
453 % \changes{v1.0g}{1994/05/13}
454 % {(DPC) Use \cs{normalcolor}}
455 % \changes{v1.1a}{1994/10/31}
456 % {(DPC/CAR) Extra box added to remove colour resetting from vmode}
457 % \changes{v1.1a}{1994/10/31}{Reset hook added}
458 % \changes{v1.1c}{1994/11/05}
459 % {Use new \cs{color@hbox} concept.}
460 % \changes{v1.1f}{1994/11/21}
461 % {Changed to \cs{color@vbox} so that large floats overflow
463 % \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak}}
464 % \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage}}
465 % \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
466 % \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
468 \global \setbox\@currbox
476 %</2ekernel|latexrelease>
477 %<latexrelease>\EndIncludeInRelease
478 %<latexrelease>\IncludeInRelease{0000/00/00}%
479 %<latexrelease> {\@xfloat}{Check float options}%
480 %<latexrelease>\def\@xfloat #1[#2]{%
481 %<latexrelease> \@nodocument
482 %<latexrelease> \def \@captype {#1}%
483 %<latexrelease> \def \@fps {#2}%
484 %<latexrelease> \@onelevel@sanitize \@fps
485 %<latexrelease> \def \reserved@b {!}%
486 %<latexrelease> \ifx \reserved@b \@fps
487 %<latexrelease> \@fpsadddefault
488 %<latexrelease> \else
489 %<latexrelease> \ifx \@fps \@empty
490 %<latexrelease> \@fpsadddefault
493 %<latexrelease> \ifhmode
494 %<latexrelease> \@bsphack
495 %<latexrelease> \@floatpenalty -\@Mii
496 %<latexrelease> \else
497 %<latexrelease> \@floatpenalty-\@Miii
499 %<latexrelease> \ifinner
500 %<latexrelease> \@parmoderr\@floatpenalty\z@
501 %<latexrelease> \else
502 %<latexrelease> \@next\@currbox\@freelist
504 %<latexrelease> \@tempcnta \sixt@@n
505 %<latexrelease> \expandafter \@tfor \expandafter \reserved@a
506 %<latexrelease> \expandafter :\expandafter =\@fps
509 %<latexrelease> \if \reserved@a h%
510 %<latexrelease> \ifodd \@tempcnta
511 %<latexrelease> \else
512 %<latexrelease> \advance \@tempcnta \@ne
515 %<latexrelease> \if \reserved@a t%
516 %<latexrelease> \@setfpsbit \tw@
518 %<latexrelease> \if \reserved@a b%
519 %<latexrelease> \@setfpsbit 4%
521 %<latexrelease> \if \reserved@a p%
522 %<latexrelease> \@setfpsbit 8%
524 %<latexrelease> \if \reserved@a !%
525 %<latexrelease> \ifnum \@tempcnta>15
526 %<latexrelease> \advance\@tempcnta -\sixt@@n\relax
530 %<latexrelease> \@tempcntb \csname ftype@\@captype \endcsname
531 %<latexrelease> \multiply \@tempcntb \@xxxii
532 %<latexrelease> \advance \@tempcnta \@tempcntb
533 %<latexrelease> \global \count\@currbox \@tempcnta
535 %<latexrelease> \@fltovf
537 %<latexrelease> \global \setbox\@currbox
538 %<latexrelease> \color@vbox
539 %<latexrelease> \normalcolor
540 %<latexrelease> \vbox \bgroup
541 %<latexrelease> \hsize\columnwidth
542 %<latexrelease> \@parboxrestore
543 %<latexrelease> \@floatboxreset
545 %<latexrelease>\EndIncludeInRelease
550 % \begin{macro}{\@floatboxreset}
551 % \changes{v1.1a}{1994/10/31}{Macro added}
553 % The rational for allowing these normally global flags to be set
554 % locally here, via |\@parboxrestore|, was stated originally by
555 % Donald Arseneau and extended by Chris Rowley.
556 % It is because these flags are only set globally to
557 % true by section commands, and these should never appear within
558 % marginals or floats or, indeed, in any group; and they are only ever
559 % set globally to false when they are definitely true.
561 % If anyone is unhappy with this argument then both flags should be
562 % treated as in |\set@nobreak|; otherwise this command will be
564 % \changes{v1.1p}{1996/10/24}
565 % {Added local settings of flags: dangerous!!}
567 \def \@floatboxreset {%
575 % \begin{macro}{\@setnobreak}
576 % \changes{v1.1f}{1994/11/21}{Macro added}
577 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
582 \let\outer@nobreak\@nobreaktrue
589 % \begin{macro}{\@setminipage}
590 % \changes{v1.1f}{1994/11/21}{Macro added}
591 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
596 \everypar{\@minipagefalse\everypar{}}%
601 % \begin{macro}{\end@float}
602 % \changes{v1.0f}{1994/05/03}
603 % {(CAR) Added \cs{@largefloatcheck}}
604 % \changes{v1.1n}{1995/10/25}{(CAR) unify code for double and
609 \ifnum\@floatpenalty <\z@
611 % We make sure that we never exceed |\textheight|, otherwise float
612 % will never get typeset (91/03/15 FMi).
615 \@cons\@currlist\@currbox
616 \ifnum\@floatpenalty <-\@Mii
619 % Saving and restoring |\prevdepth| added 26 May 87 to prevent extra
620 % vertical space when used in vertical mode.
628 \penalty\@floatpenalty
630 % \changes{LaTeX2.09}{1992/03/18}
631 % {(RmS) changed \cs{@esphack} to \cs{@Esphack}}
634 \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack
641 % \begin{macro}{\end@dblfloat}
642 % \changes{v1.0f}{1994/05/03}{\cs{@largefloatcheck} added}
643 % \changes{v1.1n}{1995/10/25}{(CAR) unify code for double and
645 % \changes{v1.2b}{2015/01/11}{float order in 2-column (latexrelease)}
648 %<latexrelease>\IncludeInRelease{2015/01/01}%
649 %<latexrelease> {\end@dblfloat}{float order in 2-column}%
650 %<*2ekernel|latexrelease>
654 \ifnum\@floatpenalty <\z@
658 % Force the depth of two column float boxes.
660 \global\dp\@currbox1sp %
662 % What follows is essentially |\end@float| without a starting
664 % \changes{v1.2b}{2000/09/24}{FMi: use output routine to
666 % \changes{v1.2b}{2014/04/27}{Inline the code to allow some
667 % coexistence with packages that hook into \cs{end@float} and do not
668 % know about the algorithm change}
670 \@cons\@currlist\@currbox
671 \ifnum\@floatpenalty <-\@Mii
676 \penalty\@floatpenalty
678 \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack
681 % \changes{v1.2b}{2014/06/10}{missing \cs{fi} added}
688 %</2ekernel|latexrelease>
689 %<latexrelease>\EndIncludeInRelease
690 %<latexrelease>\IncludeInRelease{0000/00/00}%
691 %<latexrelease> {\end@dblfloat}{float order in 2-column}%
692 %<latexrelease>\def\end@dblfloat{%
693 %<latexrelease>\if@twocolumn
694 %<latexrelease> \@endfloatbox
695 %<latexrelease> \ifnum\@floatpenalty <\z@
697 % We make sure that we never exceed |\textheight|, otherwise float
698 % will never get typeset (91/03/15 FMi).
700 %<latexrelease> \@largefloatcheck
701 %<latexrelease> \@cons\@dbldeferlist\@currbox
704 % RmS 92/03/18 changed |\@esphack| to |\@Esphack|.
706 %<latexrelease> \ifnum \@floatpenalty =-\@Mii \@Esphack\fi
708 %<latexrelease> \end@float
711 %<latexrelease>\EndIncludeInRelease
716 % \begin{macro}{\@endfloatbox}
717 % \changes{v1.1n}{1995/10/25}{(CAR) macro added: to unify code for
718 % double and single versions}
719 % This macro is not intended to be a hook; it is designed to help
720 % maintain the integrity of this code, which is used twice and, as
721 % can be seen, is subject to frequent changes.
724 \par\vskip\z@skip %% \par\vskip\z@ added 15 Dec 87
727 % {1994/03/07}{(DPC) Extra group for colour}
728 % \changes{v1.0c}{1994/03/14}
729 % {(DPC) Use \cs{color@endgroup}}
730 % \changes{v1.0h}{1994/05/20}{Restore outer value of @nobreak switch.}
731 % \changes{v1.1a}{1994/10/31}
732 % {(DPC/CAR) Extra box added to remove colour resetting from vmode}
733 % \changes{v1.1c}{1994/11/05}
734 % {Use new \cs{color@hbox} concept.}
735 % \changes{v1.1f}{1994/11/21}{Corrected position of \cs{outer@nobreak}}
736 % \changes{v1.1f}{1994/11/21}{Added reset of minipage flag}
737 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
742 \egroup %% end of vbox
748 % \begin{macro}{\outer@nobreak}
749 % \changes{v1.0h}{1994/05/20}{Macro added: default is to do nothing.}
751 \let\outer@nobreak\@empty
756 % \begin{macro}{\@largefloatcheck}
757 % \changes{v1.0e}{1994/04/25}{Command added}
759 % This calculates by how much a float is oversize for the page and
760 % prints this in a warning message.
763 \def \@largefloatcheck{%
764 \ifdim \ht\@currbox>\textheight
765 \@tempdima -\textheight
766 \advance \@tempdima \ht\@currbox
768 % \changes{v1.0e}{1994/04/25}{Changed warning message to give more
771 \@latex@warning {Float too large for page by \the\@tempdima}%
772 \ht\@currbox \textheight
778 % \begin{macro}{\@dbflt}
779 % \begin{macro}{\@xdblfloat}
780 % \changes{v1.1a}{1994/10/31}
781 % {Macros removed: \cs{@dbflt}, \cs{@xdblfloat}}
782 % \changes{v1.1g}{1994/12/10}{Macros reinserted temporarily}
786 \def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[tp]}}
787 \def\@xdblfloat#1[#2]{%
788 \@xfloat{#1}[#2]\hsize\textwidth\linewidth\textwidth}
794 % Moved to ltoutput 93/12/16
796 %\newcount\c@topnumber
797 %\newcount\c@dbltopnumber
798 %\newcount\c@bottomnumber
799 %\newcount\c@totalnumber
802 % \begin{macro}{\@dblfloatplacement}
803 % An analysis of |\@floatplacement|:
805 % This should be called whenever |\@colht| has been set.
807 \def\@floatplacement{\global\@topnum\c@topnumber
808 % Textpage bit, global:
809 \global\@toproom \topfraction\@colht
810 \global\@botnum \c@bottomnumber
811 \global\@botroom \bottomfraction\@colht
812 \global\@colnum \c@totalnumber
813 % Floatpage bit, local:
814 \@fpmin \floatpagefraction\@colht}
819 % \begin{macro}{\@dblfloatplacement}
820 % \changes{LaTeX2e}{1993/12/05}{Command changed}
822 % This should be called only within a group. Now changed to
823 % provide extra checks in |\@addtodblcol|, needed when processing a
826 % \changes{v1.2b}{2015/01/11}{float order in 2-column (latexrelease)}
828 %<latexrelease>\IncludeInRelease{2015/01/01}%
829 %<latexrelease> {\@dblfloatplacement}{float order in 2-column}%
830 %<*2ekernel|latexrelease>
832 % When making two column float area, look for floats with 1sp
835 \def\@dblfloatplacement{\global\@dbltopnum\c@dbltopnumber
836 \global\@dbltoproom \dbltopfraction\@colht
838 \advance \@textmin -\@dbltoproom
839 \@fpmin \dblfloatpagefraction\textheight
844 % |\f@depth| is used in |\@testwrongwidth| to look for either
845 % column or dbl-column floats. A value of |1sp| signals the
846 % latter. Because of this setting here, |\@dblfloatplacment| needs to
847 % be called inside a group which is a questionable design.
853 %</2ekernel|latexrelease>
854 %<latexrelease>\EndIncludeInRelease
855 %<latexrelease>\IncludeInRelease{0000/00/00}%
856 %<latexrelease> {\@dblfloatplacement}{float order in 2-column}%
857 %<latexrelease>\def \@dblfloatplacement {%
859 % Textpage bit: global, but need not be.
861 %<latexrelease> \global \@dbltopnum \c@dbltopnumber
862 %<latexrelease> \global \@dbltoproom \dbltopfraction\@colht
864 % This new bit uses |\@textmin| to locally store the amount of extra
865 % room in the column.
867 %<latexrelease> \@textmin \@colht
868 %<latexrelease> \advance \@textmin -\@dbltoproom
870 % Floatpage bit: must be local.
872 %<latexrelease> \@fpmin \dblfloatpagefraction\textheight
873 %<latexrelease> \@fptop \@dblfptop
874 %<latexrelease> \@fpsep \@dblfpsep
875 %<latexrelease> \@fpbot \@dblfpbot
877 %<latexrelease>\EndIncludeInRelease
883 % \begin{oldcomments}
886 % Marginal notes use the same mechanism as floats to communicate
887 % with the \output routine. Marginal notes are distinguished from
888 % floats by having a negative placement specification. The command
889 % \marginpar [LTEXT]{RTEXT} generates a marginal note in a parbox,
890 % using LTEXT if it's on the left and RTEXT if it's on the right.
891 % (Default is RTEXT = LTEXT.) It uses the following parameters.
893 % \marginparwidth : Width of marginal notes.
894 % \marginparsep : Distance between marginal note and text.
895 % the page layout to determine how to move the marginal
896 % note into the margin. E.g., \@leftmarginskip ==
897 % \hskip -\marginparwidth \hskip -\marginparsep .
898 % \marginparpush : Minimum vertical separation between \marginpar's
900 % Marginal notes are normally put on the outside of the page
901 % if @mparswitch = true, and on the right if @mparswitch = false.
902 % The command \reversemarginpar reverses the side where they
903 % are put. \normalmarginpar undoes \reversemarginpar.
904 % These commands have no effect for two-column output.
906 % SURPRISE: if two marginal notes appear on the same line of
907 % text, then the second one could appear on the next page, in
911 % \marginpar [LTEXT]{RTEXT} ==
913 % if hmode then \@bsphack
914 % \@floatpenalty := -10002
915 % else \@floatpenalty := -10003
918 % then LaTeX Error: 'Not in outer paragraph mode.'
919 % \@floatpenalty := 0
920 % else if \@freelist has two elements:
921 % then get \@marbox, \@currbox from \@freelist
922 % \count\@marbox :=G -1
923 % else \@floatpenalty := 0
924 % LaTeX Error: 'Too many unprocessed floats'
925 % \@currbox, \@marbox := \@tempboxa %%use \def
928 % if optional argument
930 % \@savemarbox\@marbox{LTEXT}
931 % \@savemarbox\@currbox{RTEXT}
933 % \@savemarbox\@marbox{RTEXT}
934 % \box\@currbox :=G \box\@marbox
939 % \reversemarginpar == BEGIN \@mparbottom :=G 0
940 % @reversemargin :=G true
943 % \normalmarginpar == BEGIN \@mparbottom :=G 0
944 % @reversemargin :=G false
949 % \begin{macro}{\marginpar}
954 \@floatpenalty -\@Mii
956 \@floatpenalty-\@Miii
962 \@next\@currbox\@freelist{}{}%
963 \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
965 \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
967 \@ifnextchar [\@xmpar\@ympar}
971 % \begin{macro}{\@xmpar}
973 \long\def\@xmpar[#1]#2{%
974 \@savemarbox\@marbox{#1}%
975 \@savemarbox\@currbox{#2}%
980 % \begin{macro}{\@ympar}
983 \@savemarbox\@marbox{#1}%
984 \global\setbox\@currbox\copy\@marbox
989 % \begin{macro}{\@savemarbox}
990 % \changes{v1.0b}{1994/03/12}
991 % {(DPC) Extra group for colour}
992 % \changes{v1.0c}{1994/03/14}
993 % {(DPC) Use \cs{color@begingroup}}
994 % \changes{v1.0d}{1994/04/18}
995 % {(DPC) Remove Colour support}
996 % \changes{v1.1a}{1994/10/31}
997 % {(DPC/CAR) Extra box added for colour}
998 % \changes{v1.1c}{1994/11/05}
999 % {Use new \cs{color@hbox} concept.}
1000 % \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
1001 % \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak} etc}
1002 % \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage} etc}
1003 % \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
1004 % \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
1005 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
1006 % \cs{@minipage...}}
1008 \long\def \@savemarbox #1#2{%
1012 \hsize\marginparwidth
1024 % \begin{macro}{\@marginparreset}
1025 % \changes{v1.1f}{1994/11/21}{Macro added}
1027 % The rational for allowing these normally global flags to be set
1028 % locally here, via |\@parboxrestore| was stated originally by
1029 % Donald Arsenau and extended by Chris Rowley.
1030 % It is because these flags are only set globally to
1031 % true by section commands, and these should never appear within
1032 % marginals or floats or, indeed, in any group; and they are only ever
1033 % set globally to false when they are definitely true.
1035 % If anyone is unhappy with this argument then both flags should be
1036 % treated as in |\set@nobreak|; otherwise this command will be
1038 % \changes{v1.1p}{1996/10/24}
1039 % {Added local settings of flags: dangerous!!}
1041 \def \@marginparreset {%
1044 % \let\if@nobreak\iffalse
1045 % \let\if@noskipsec\iffalse
1052 % \begin{macro}{\@xympar}
1055 % \changes{LaTeX2.09}{1992/03/18}
1056 % {(RmS) added \cs{global}\cs{@ignorefalse}}
1057 % \changes{v1.0b}{1994/03/12}
1058 % {(DPC) Extra bgroup for colour}
1059 % \changes{1.0c}{1994/03/14}
1060 % {(DPC) Use \cs{color@begingroup}}
1061 % \changes{v1.1a}{1994/10/31}
1062 % {(DPC/CAR) Extra box added since needed for floats}
1063 % \changes{v1.1c}{1994/11/05}
1064 % {Use new \cs{color@hbox} concept.}
1065 % \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
1066 % Setting the box here is done only because the code
1067 % uses \cs{end@float}; it will be empty and gets discarded.
1068 % \changes{v1.1o}{1996/08/02}{Remove \cs{global} before \cs{@ignore...}}
1071 \ifnum\@floatpenalty <\z@\@cons\@currlist\@marbox\fi
1082 % \begin{macro}{\reversemarginpar}
1083 % \begin{macro}{\normalmarginpar}
1085 \def\reversemarginpar{\global\@mparbottom\z@ \@reversemargintrue}
1086 \def\normalmarginpar{\global\@mparbottom\z@ \@reversemarginfalse}
1092 \message{footnotes,}
1095 % \subsection{Footnotes}
1097 % \begin{oldcomments}
1099 % \footnote{NOTE} : User command to insert a footnote.
1101 % \footnote[NUM]{NOTE}: User command to insert a footnote numbered
1102 % NUM, where NUM is a number -- 1, 2,
1103 % etc. For example, if footnotes are numbered
1104 % *, **, etc. within pages, then \footnote[2]{...}
1105 % produces footnote '**'. This command does not
1106 % step the footnote counter.
1108 % \footnotemark[NUM] : Command to produce just the footnote mark in
1109 % the text, but no footnote. With no argument,
1110 % it steps the footnote counter before generating
1113 % \footnotetext[NUM]{TEXT} : Command to produce the footnote but
1114 % no mark. \footnote is equivalent to
1115 % \footnotemark \footnotetext .
1117 % As in PLAIN, footnotes use \insert\footins, and the following
1120 % \footnotesize : Size-changing command for footnotes.
1122 % \footnotesep : The height of a strut placed at the beginning of
1124 % \skip\footins : Space between main text and footnotes. The rule
1125 % separating footnotes from text occurs in this
1126 % space. This space lies above the strut of height
1127 % \footnotesep which is at the beginning of the
1129 % \footnoterule : Macro to draw the rule separating footnotes from
1130 % text. It is executed right after a \vspace of
1131 % \skip\footins. It should take zero vertical
1132 % space--i.e., it should to a negative skip to
1133 % compensate for any positive space it occupies.
1136 % \interfootnotelinepenalty : Interline penalty for footnotes.
1138 % \thefootnote : In usual LaTeX style, produces the footnote number.
1139 % If footnotes are to be numbered within pages, then
1140 % the document style file must include an \@addtoreset
1141 % command to cause the footnote counter to be reset
1142 % when the page counter is stepped. This is not a good
1143 % idea, though, because the counter will not always be
1144 % reset in time to ensure that the first footnote on a
1145 % page is footnote number one.
1147 % \@thefnmark : Holds the current footnote's mark--e.g., \dag or '1'
1150 % \@mpfnnumber : A macro that generates the numbers for \footnote
1151 % and \footnotemark commands. It == \thefootnote
1152 % outside a minipage environment, but can be
1153 % changed inside to generate numbers for
1156 % \@makefnmark : A macro to generate the footnote marker from
1157 % \@thefnmark The default definition was
1158 % \hbox{$^\@thefnmark$}.
1160 % This is now replaced by
1161 % \textsuperscript{\@thefnmark}
1163 % \@makefntext{NOTE} :
1164 % Must produce the actual footnote, using \@thefnmark as the mark
1165 % of the footnote and NOTE as the text. It is called when
1166 % effectively inside a \parbox, with \hsize = \columnwidth.
1167 % For example, it might be as simple as
1168 % $^{\@thefnmark}$ NOTE
1170 % In a minipage environment, \footnote and \footnotetext are redefined
1172 % (a) they use the counter mpfootnote
1173 % (b) the footnotes they produce go at the bottom of the minipage.
1174 % The switch is accomplished by letting \@mpfn == footnote or mpfootnote
1175 % and \thempfn == \thefootnote or \thempfootnote, and by redefining
1176 % \@footnotetext to be \@mpfootnotetext in the minipage.
1178 % \footnote{NOTE} ==
1180 % \stepcounter{\@mpfn}
1182 % \protect == \noexpand
1183 % \@thefnmark :=G eval (\thempfn)
1186 % \@footnotetext{NOTE}
1189 % \footnote[NUM]{NOTE} ==
1192 % \protect == \noexpand
1193 % counter \@mpfn :=L NUM
1194 % \@thefnmark :=G eval (\thempfn)
1197 % \@footnotetext{NOTE}
1201 % BEGIN \stepcounter{footnote}
1203 % \protect == \noexpand
1204 % \@thefnmark :=G eval(\thefootnote)
1209 % \footnotemark[NUM] ==
1212 % footnote counter :=L NUM
1213 % \protect == \noexpand
1214 % \@thefnmark :=G eval(\thefootnote)
1222 % IF hmode THEN \@x@sf := \the\spacefactor FI
1223 % \@makefnmark % put number in main text
1224 % IF hmode THEN \spacefactor := \@x@sf FI
1228 % BEGIN begingroup \protect == \noexpand
1229 % \@thefnmark :=G eval (\thempfn)
1234 % \footnotetext[NUM] ==
1235 % BEGIN begingroup counter \@mpfn :=L NUM
1236 % \protect == \noexpand
1237 % \@thefnmark :=G eval (\thempfn)
1245 % \changes{v1.1l}{1995/05/24}{Moved definition of \cs{footins}
1246 % and \cs{footnoterule} from ltplain.}
1248 % \begin{macro}{\footins}
1249 % \LaTeX\ does use the same insert for footnotes as PLAIN.
1254 % \LaTeX\ leaves these initializations for the |\footins| insert.
1257 \skip\footins=\bigskipamount % space added when footnote is present
1258 \count\footins=1000 % footnote magnification factor (1 to 1)
1259 \dimen\footins=8in % maximum footnotes per page
1264 % \begin{macro}{\footnoterule}
1265 % \LaTeX\ keeps PLAIN \TeX's |\footnoterule| as the default.
1268 \def\footnoterule{\kern-3\p@
1269 \hrule \@width 2in \kern 2.6\p@} % the \hrule is .4pt high
1273 % \begin{macro}{\thefootnote}
1274 % \changes{v1.1i}{1995/05/16}{Streamlined parts of code.}
1276 \@definecounter{footnote}
1277 \def\thefootnote{\@arabic\c@footnote}
1281 % \begin{macro}{\thempfootnote}
1282 % \changes{v1.1j}{1995/05/18}{Added \cs{itshape}.}
1283 % \changes{v1.1v}{2002/10/01}{Use braces around \cs{itshape}
1284 % to keep font change local (pr/3460).}
1285 % The default display for the footnote counter in minipages is to
1286 % use italic letters. We use |\itshape| not |\textit| as the latter
1287 % would add an italic correction.
1289 \@definecounter{mpfootnote}
1290 \def\thempfootnote{{\itshape\@alph\c@mpfootnote}}
1294 % \begin{macro}{\@makefnmark}
1295 % \changes{v1.1i}{1995/05/16}{Now use \cs{textsuperscript}.}
1296 % \changes{v1.1j}{1995/05/18}{Added \cs{normalfont}.}
1297 % \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} to
1298 % \cs{textsuperscript}}
1299 % \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} back
1300 % and use \cs{@textsuperscript}}
1301 % Default definition.
1303 %\def\@makefnmark{\hbox{$^{\@thefnmark}\m@th$}}
1304 \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}}
1308 % \begin{macro}{\textsuperscript}
1309 % \changes{v1.1i}{1995/05/16}{Command added./pr1503}
1310 % \changes{v1.1k}{1995/05/20}{Use \cs{normalfont}.}
1311 % \changes{v1.1l}{1995/05/24}{Use \cs{@textsuperscript}}
1312 % This command provides superscript characters in the current text
1313 % font. It's implementation might change!!!
1315 \DeclareRobustCommand*\textsuperscript[1]{%
1316 \@textsuperscript{\selectfont#1}}
1320 % \begin{macro}{\@textsuperscript}
1321 % \changes{v1.1l}{1995/05/24}{Command added.}
1322 % \changes{v1.1n}{1995/12/05}{Use \cs{ensuremath} for latex/1984.}
1323 % \changes{v1.1m}{1995/12/07}
1324 % {Move \cs{m@th} out of the \cs{ensuremath} for latex/1984.}
1325 % This command should not be used directly, but may be used to define
1326 % other commands |\textsuperscript|, |\@makefnmark|. |#1| should
1327 % always start with a font selection command, to activate the font
1330 \def\@textsuperscript#1{%
1331 {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}
1335 % \begin{macro}{\textsubscript}
1336 % \changes{v1.2a}{2014/12/30}{Command added (latexrelease)}
1339 %<latexrelease>\IncludeInRelease{2015/01/01}%
1340 %<latexrelease> {\textsubscript}{\textsubscript}%
1341 %<*2ekernel|latexrelease>
1345 \DeclareRobustCommand*\textsubscript[1]{%
1346 \@textsubscript{\selectfont#1}}%
1350 % \begin{macro}{\@textsubscript}
1351 % \changes{v1.2a}{2014/12/30}{Command added (latexrelease)}
1354 \def\@textsubscript#1{%
1355 {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}%
1360 %</2ekernel|latexrelease>
1361 %<latexrelease>\EndIncludeInRelease
1362 %<latexrelease>\IncludeInRelease{0000/00/00}%
1363 %<latexrelease> {\textsubscript}{\textsubscript}%
1364 %<latexrelease>\let\textsubscript\@undefined
1365 %<latexrelease>\let\@textsubscript\@undefined
1366 %<latexrelease>\EndIncludeInRelease
1371 \def\@textsubscript#1{%
1372 {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
1375 % \begin{macro}{\footnotesep}
1377 \newdimen\footnotesep
1382 % \begin{macro}{\footnote}
1383 % \changes{LaTeX2.09}{1991/11/01}
1384 % {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
1385 % \cs{footnote}, \cs{footnotemark},
1386 % and \cs{footnotetext}, since \cs{xdef} is used}
1387 % \changes{LaTeX2.09}{1991/11/22}
1388 % {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
1389 % \cs{@xfootnote}, \cs{@xfootnotemark},
1390 % and \cs{@xfootnotetext}}
1391 % \changes{LaTeX2.09}{1992/11/26}
1392 % {(RmS) Changed all to
1393 % `def`protect\string{`noexpand`protect`noexpand\string}}
1394 % \changes{v1.1b}{1994/11/26}
1395 % {(ASAJ) Added \cs{protected@xdef}.}
1398 \def\footnote{\@ifnextchar[\@xfootnote{\stepcounter\@mpfn
1399 \protected@xdef\@thefnmark{\thempfn}%
1400 \@footnotemark\@footnotetext}}
1404 % \begin{macro}{\@xfootnote}
1406 \def\@xfootnote[#1]{%
1408 \csname c@\@mpfn\endcsname #1\relax
1409 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1411 \@footnotemark\@footnotetext}
1415 % \begin{macro}{\@footnotetext}
1416 % \changes{LaTeX2.09}{1991/09/29}
1417 % {(RmS) added \cs{reset@font}}
1418 % \changes{LaTeX2.09}{1992/11/26}
1419 % {(RmS) added protection for \cs{edef}}
1420 % \changes{v1.0a}{1994/03/07}
1421 % {(DPC) Extra group for colour}
1422 % \changes{v1.0c}{1994/03/14}
1423 % {(DPC) Use \cs{color@begingroup}, add \cs{endgraf}}
1424 % \changes{v1.0d}{1994/04/18}
1425 % {(DPC) Remove Colour support}
1426 % \changes{v1.0g}{1994/05/13}
1427 % {(DPC) Add new style colour support: \cs{normalcolor}}
1428 % \changes{v1.0g}{1994/05/13}
1429 % {(DPC) Use \cs{@finalstrut}}
1430 % \changes{v1.1a}{1994/10/31}
1431 % {(DPC/CAR) Move colour setting to output routine}
1432 % \changes{v1.1b}{1994/11/04}
1433 % {(ASAJ) Added \cs{protected@edef}.}
1434 % \changes{v1.1c}{1994/11/05}
1435 % {Removed \cs{normalcolor} (again)}
1436 % \changes{v1.1t}{1997/11/19}
1437 % {Missing percent, again}
1439 \long\def\@footnotetext#1{\insert\footins{%
1440 \reset@font\footnotesize
1441 \interlinepenalty\interfootnotelinepenalty
1442 \splittopskip\footnotesep
1443 \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
1444 \hsize\columnwidth \@parboxrestore
1445 \protected@edef\@currentlabel{%
1446 \csname p@footnote\endcsname\@thefnmark
1450 \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1455 % \begin{macro}{\footnotemark}
1456 % \changes{v1.1b}{1994/11/04}{Added \cs{protected@xdef} to
1457 % \cs{footnotemark}.}
1460 \@ifnextchar[\@xfootnotemark
1461 {\stepcounter{footnote}%
1462 \protected@xdef\@thefnmark{\thefootnote}%
1467 % \begin{macro}{\@xfootnotemark}
1469 \def\@xfootnotemark[#1]{%
1471 \c@footnote #1\relax
1472 \unrestored@protected@xdef\@thefnmark{\thefootnote}%
1478 % \begin{macro}{\@footnotemark}
1479 % \changes{v1.1h}{1995/05/12}
1480 % {Add \cs{nobreak} to allow hyphenation. latex/1605}
1482 \def\@footnotemark{%
1484 \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
1486 \ifhmode\spacefactor\@x@sf\fi
1491 % \begin{macro}{\footnotetext}
1494 \@ifnextchar [\@xfootnotenext
1495 {\protected@xdef\@thefnmark{\thempfn}%
1500 % \begin{macro}{\@xfootnotenext}
1502 \def\@xfootnotenext[#1]{%
1504 \csname c@\@mpfn\endcsname #1\relax
1505 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1511 % \begin{macro}{\thempfn}
1512 % \begin{macro}{\@mpfn}
1514 \def\@mpfn{footnote}
1515 \def\thempfn{\thefootnote}