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
746 % \begin{macro}{\outer@nobreak}
747 % \changes{v1.0h}{1994/05/20}{Macro added: default is to do nothing.}
749 \let\outer@nobreak\@empty
754 % \begin{macro}{\@largefloatcheck}
755 % \changes{v1.0e}{1994/04/25}{Command added}
757 % This calculates by how much a float is oversize for the page and
758 % prints this in a warning message.
761 \def \@largefloatcheck{%
762 \ifdim \ht\@currbox>\textheight
763 \@tempdima -\textheight
764 \advance \@tempdima \ht\@currbox
766 % \changes{v1.0e}{1994/04/25}{Changed warning message to give more
769 \@latex@warning {Float too large for page by \the\@tempdima}%
770 \ht\@currbox \textheight
776 % \begin{macro}{\@dbflt}
777 % \begin{macro}{\@xdblfloat}
778 % \changes{v1.1a}{1994/10/31}
779 % {Macros removed: \cs{@dbflt}, \cs{@xdblfloat}}
780 % \changes{v1.1g}{1994/12/10}{Macros reinserted temporarily}
784 \def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[tp]}}
785 \def\@xdblfloat#1[#2]{%
786 \@xfloat{#1}[#2]\hsize\textwidth\linewidth\textwidth}
792 % Moved to ltoutput 93/12/16
794 %\newcount\c@topnumber
795 %\newcount\c@dbltopnumber
796 %\newcount\c@bottomnumber
797 %\newcount\c@totalnumber
800 % \begin{macro}{\@dblfloatplacement}
801 % An analysis of |\@floatplacement|:
803 % This should be called whenever |\@colht| has been set.
805 \def\@floatplacement{\global\@topnum\c@topnumber
806 % Textpage bit, global:
807 \global\@toproom \topfraction\@colht
808 \global\@botnum \c@bottomnumber
809 \global\@botroom \bottomfraction\@colht
810 \global\@colnum \c@totalnumber
811 % Floatpage bit, local:
812 \@fpmin \floatpagefraction\@colht}
817 % \begin{macro}{\@dblfloatplacement}
818 % \changes{LaTeX2e}{1993/12/05}{Command changed}
820 % This should be called only within a group. Now changed to
821 % provide extra checks in |\@addtodblcol|, needed when processing a
824 % \changes{v1.2b}{2015/01/11}{float order in 2-column (latexrelease)}
826 %<latexrelease>\IncludeInRelease{2015/01/01}%
827 %<latexrelease> {\@dblfloatplacement}{float order in 2-column}%
828 %<*2ekernel|latexrelease>
830 % When making two column float area, look for floats with 1sp
833 \def\@dblfloatplacement{\global\@dbltopnum\c@dbltopnumber
834 \global\@dbltoproom \dbltopfraction\@colht
836 \advance \@textmin -\@dbltoproom
837 \@fpmin \dblfloatpagefraction\textheight
842 % |\f@depth| is used in |\@testwrongwidth| to look for either
843 % column or dbl-column floats. A value of |1sp| signals the
844 % latter. Because of this setting here, |\@dblfloatplacment| needs to
845 % be called inside a group which is a questionable design.
851 %</2ekernel|latexrelease>
852 %<latexrelease>\EndIncludeInRelease
853 %<latexrelease>\IncludeInRelease{0000/00/00}%
854 %<latexrelease> {\@dblfloatplacement}{float order in 2-column}%
855 %<latexrelease>\def \@dblfloatplacement {%
857 % Textpage bit: global, but need not be.
859 %<latexrelease> \global \@dbltopnum \c@dbltopnumber
860 %<latexrelease> \global \@dbltoproom \dbltopfraction\@colht
862 % This new bit uses |\@textmin| to locally store the amount of extra
863 % room in the column.
865 %<latexrelease> \@textmin \@colht
866 %<latexrelease> \advance \@textmin -\@dbltoproom
868 % Floatpage bit: must be local.
870 %<latexrelease> \@fpmin \dblfloatpagefraction\textheight
871 %<latexrelease> \@fptop \@dblfptop
872 %<latexrelease> \@fpsep \@dblfpsep
873 %<latexrelease> \@fpbot \@dblfpbot
875 %<latexrelease>\EndIncludeInRelease
881 % \begin{oldcomments}
884 % Marginal notes use the same mechanism as floats to communicate
885 % with the \output routine. Marginal notes are distinguished from
886 % floats by having a negative placement specification. The command
887 % \marginpar [LTEXT]{RTEXT} generates a marginal note in a parbox,
888 % using LTEXT if it's on the left and RTEXT if it's on the right.
889 % (Default is RTEXT = LTEXT.) It uses the following parameters.
891 % \marginparwidth : Width of marginal notes.
892 % \marginparsep : Distance between marginal note and text.
893 % the page layout to determine how to move the marginal
894 % note into the margin. E.g., \@leftmarginskip ==
895 % \hskip -\marginparwidth \hskip -\marginparsep .
896 % \marginparpush : Minimum vertical separation between \marginpar's
898 % Marginal notes are normally put on the outside of the page
899 % if @mparswitch = true, and on the right if @mparswitch = false.
900 % The command \reversemarginpar reverses the side where they
901 % are put. \normalmarginpar undoes \reversemarginpar.
902 % These commands have no effect for two-column output.
904 % SURPRISE: if two marginal notes appear on the same line of
905 % text, then the second one could appear on the next page, in
909 % \marginpar [LTEXT]{RTEXT} ==
911 % if hmode then \@bsphack
912 % \@floatpenalty := -10002
913 % else \@floatpenalty := -10003
916 % then LaTeX Error: 'Not in outer paragraph mode.'
917 % \@floatpenalty := 0
918 % else if \@freelist has two elements:
919 % then get \@marbox, \@currbox from \@freelist
920 % \count\@marbox :=G -1
921 % else \@floatpenalty := 0
922 % LaTeX Error: 'Too many unprocessed floats'
923 % \@currbox, \@marbox := \@tempboxa %%use \def
926 % if optional argument
928 % \@savemarbox\@marbox{LTEXT}
929 % \@savemarbox\@currbox{RTEXT}
931 % \@savemarbox\@marbox{RTEXT}
932 % \box\@currbox :=G \box\@marbox
937 % \reversemarginpar == BEGIN \@mparbottom :=G 0
938 % @reversemargin :=G true
941 % \normalmarginpar == BEGIN \@mparbottom :=G 0
942 % @reversemargin :=G false
947 % \begin{macro}{\marginpar}
952 \@floatpenalty -\@Mii
954 \@floatpenalty-\@Miii
960 \@next\@currbox\@freelist{}{}%
961 \@next\@marbox\@freelist{\global\count\@marbox\m@ne}%
963 \@fltovf\def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}%
965 \@ifnextchar [\@xmpar\@ympar}
969 % \begin{macro}{\@xmpar}
971 \long\def\@xmpar[#1]#2{%
972 \@savemarbox\@marbox{#1}%
973 \@savemarbox\@currbox{#2}%
978 % \begin{macro}{\@ympar}
981 \@savemarbox\@marbox{#1}%
982 \global\setbox\@currbox\copy\@marbox
987 % \begin{macro}{\@savemarbox}
988 % \changes{v1.0b}{1994/03/12}
989 % {(DPC) Extra group for colour}
990 % \changes{v1.0c}{1994/03/14}
991 % {(DPC) Use \cs{color@begingroup}}
992 % \changes{v1.0d}{1994/04/18}
993 % {(DPC) Remove Colour support}
994 % \changes{v1.1a}{1994/10/31}
995 % {(DPC/CAR) Extra box added for colour}
996 % \changes{v1.1c}{1994/11/05}
997 % {Use new \cs{color@hbox} concept.}
998 % \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
999 % \changes{v1.1f}{1994/11/21}{Use \cs{@setnobreak} etc}
1000 % \changes{v1.1f}{1994/11/21}{Added \cs{@setminipage} etc}
1001 % \changes{v1.1f}{1994/11/21}{Added resetting of size and font}
1002 % \changes{v1.1m}{1995/05/25}{(CAR) Resettings moved to hook}
1003 % \changes{v1.1n}{1996/07/26}{remove unecessary \cs{global} before
1004 % \cs{@minipage...}}
1006 \long\def \@savemarbox #1#2{%
1010 \hsize\marginparwidth
1022 % \begin{macro}{\@marginparreset}
1023 % \changes{v1.1f}{1994/11/21}{Macro added}
1025 % The rational for allowing these normally global flags to be set
1026 % locally here, via |\@parboxrestore| was stated originally by
1027 % Donald Arsenau and extended by Chris Rowley.
1028 % It is because these flags are only set globally to
1029 % true by section commands, and these should never appear within
1030 % marginals or floats or, indeed, in any group; and they are only ever
1031 % set globally to false when they are definitely true.
1033 % If anyone is unhappy with this argument then both flags should be
1034 % treated as in |\set@nobreak|; otherwise this command will be
1036 % \changes{v1.1p}{1996/10/24}
1037 % {Added local settings of flags: dangerous!!}
1039 \def \@marginparreset {%
1042 % \let\if@nobreak\iffalse
1043 % \let\if@noskipsec\iffalse
1050 % \begin{macro}{\@xympar}
1053 % \changes{LaTeX2.09}{1992/03/18}
1054 % {(RmS) added \cs{global}\cs{@ignorefalse}}
1055 % \changes{v1.0b}{1994/03/12}
1056 % {(DPC) Extra bgroup for colour}
1057 % \changes{1.0c}{1994/03/14}
1058 % {(DPC) Use \cs{color@begingroup}}
1059 % \changes{v1.1a}{1994/10/31}
1060 % {(DPC/CAR) Extra box added since needed for floats}
1061 % \changes{v1.1c}{1994/11/05}
1062 % {Use new \cs{color@hbox} concept.}
1063 % \changes{v1.1f}{1994/11/21}{Changed to \cs{color@vbox} }
1064 % Setting the box here is done only because the code
1065 % uses \cs{end@float}; it will be empty and gets discarded.
1066 % \changes{v1.1o}{1996/08/02}{Remove \cs{global} before \cs{@ignore...}}
1069 \ifnum\@floatpenalty <\z@\@cons\@currlist\@marbox\fi
1080 % \begin{macro}{\reversemarginpar}
1081 % \begin{macro}{\normalmarginpar}
1083 \def\reversemarginpar{\global\@mparbottom\z@ \@reversemargintrue}
1084 \def\normalmarginpar{\global\@mparbottom\z@ \@reversemarginfalse}
1090 \message{footnotes,}
1093 % \subsection{Footnotes}
1095 % \begin{oldcomments}
1097 % \footnote{NOTE} : User command to insert a footnote.
1099 % \footnote[NUM]{NOTE}: User command to insert a footnote numbered
1100 % NUM, where NUM is a number -- 1, 2,
1101 % etc. For example, if footnotes are numbered
1102 % *, **, etc. within pages, then \footnote[2]{...}
1103 % produces footnote '**'. This command does not
1104 % step the footnote counter.
1106 % \footnotemark[NUM] : Command to produce just the footnote mark in
1107 % the text, but no footnote. With no argument,
1108 % it steps the footnote counter before generating
1111 % \footnotetext[NUM]{TEXT} : Command to produce the footnote but
1112 % no mark. \footnote is equivalent to
1113 % \footnotemark \footnotetext .
1115 % As in PLAIN, footnotes use \insert\footins, and the following
1118 % \footnotesize : Size-changing command for footnotes.
1120 % \footnotesep : The height of a strut placed at the beginning of
1122 % \skip\footins : Space between main text and footnotes. The rule
1123 % separating footnotes from text occurs in this
1124 % space. This space lies above the strut of height
1125 % \footnotesep which is at the beginning of the
1127 % \footnoterule : Macro to draw the rule separating footnotes from
1128 % text. It is executed right after a \vspace of
1129 % \skip\footins. It should take zero vertical
1130 % space--i.e., it should to a negative skip to
1131 % compensate for any positive space it occupies.
1134 % \interfootnotelinepenalty : Interline penalty for footnotes.
1136 % \thefootnote : In usual LaTeX style, produces the footnote number.
1137 % If footnotes are to be numbered within pages, then
1138 % the document style file must include an \@addtoreset
1139 % command to cause the footnote counter to be reset
1140 % when the page counter is stepped. This is not a good
1141 % idea, though, because the counter will not always be
1142 % reset in time to ensure that the first footnote on a
1143 % page is footnote number one.
1145 % \@thefnmark : Holds the current footnote's mark--e.g., \dag or '1'
1148 % \@mpfnnumber : A macro that generates the numbers for \footnote
1149 % and \footnotemark commands. It == \thefootnote
1150 % outside a minipage environment, but can be
1151 % changed inside to generate numbers for
1154 % \@makefnmark : A macro to generate the footnote marker from
1155 % \@thefnmark The default definition was
1156 % \hbox{$^\@thefnmark$}.
1158 % This is now replaced by
1159 % \textsuperscript{\@thefnmark}
1161 % \@makefntext{NOTE} :
1162 % Must produce the actual footnote, using \@thefnmark as the mark
1163 % of the footnote and NOTE as the text. It is called when
1164 % effectively inside a \parbox, with \hsize = \columnwidth.
1165 % For example, it might be as simple as
1166 % $^{\@thefnmark}$ NOTE
1168 % In a minipage environment, \footnote and \footnotetext are redefined
1170 % (a) they use the counter mpfootnote
1171 % (b) the footnotes they produce go at the bottom of the minipage.
1172 % The switch is accomplished by letting \@mpfn == footnote or mpfootnote
1173 % and \thempfn == \thefootnote or \thempfootnote, and by redefining
1174 % \@footnotetext to be \@mpfootnotetext in the minipage.
1176 % \footnote{NOTE} ==
1178 % \stepcounter{\@mpfn}
1180 % \protect == \noexpand
1181 % \@thefnmark :=G eval (\thempfn)
1184 % \@footnotetext{NOTE}
1187 % \footnote[NUM]{NOTE} ==
1190 % \protect == \noexpand
1191 % counter \@mpfn :=L NUM
1192 % \@thefnmark :=G eval (\thempfn)
1195 % \@footnotetext{NOTE}
1199 % BEGIN \stepcounter{footnote}
1201 % \protect == \noexpand
1202 % \@thefnmark :=G eval(\thefootnote)
1207 % \footnotemark[NUM] ==
1210 % footnote counter :=L NUM
1211 % \protect == \noexpand
1212 % \@thefnmark :=G eval(\thefootnote)
1220 % IF hmode THEN \@x@sf := \the\spacefactor FI
1221 % \@makefnmark % put number in main text
1222 % IF hmode THEN \spacefactor := \@x@sf FI
1226 % BEGIN begingroup \protect == \noexpand
1227 % \@thefnmark :=G eval (\thempfn)
1232 % \footnotetext[NUM] ==
1233 % BEGIN begingroup counter \@mpfn :=L NUM
1234 % \protect == \noexpand
1235 % \@thefnmark :=G eval (\thempfn)
1243 % \changes{v1.1l}{1995/05/24}{Moved definition of \cs{footins}
1244 % and \cs{footnoterule} from ltplain.}
1246 % \begin{macro}{\footins}
1247 % \LaTeX\ does use the same insert for footnotes as PLAIN.
1252 % \LaTeX\ leaves these initializations for the |\footins| insert.
1255 \skip\footins=\bigskipamount % space added when footnote is present
1256 \count\footins=1000 % footnote magnification factor (1 to 1)
1257 \dimen\footins=8in % maximum footnotes per page
1262 % \begin{macro}{\footnoterule}
1263 % \LaTeX\ keeps PLAIN \TeX's |\footnoterule| as the default.
1266 \def\footnoterule{\kern-3\p@
1267 \hrule \@width 2in \kern 2.6\p@} % the \hrule is .4pt high
1271 % \begin{macro}{\thefootnote}
1272 % \changes{v1.1i}{1995/05/16}{Streamlined parts of code.}
1274 \@definecounter{footnote}
1275 \def\thefootnote{\@arabic\c@footnote}
1279 % \begin{macro}{\thempfootnote}
1280 % \changes{v1.1j}{1995/05/18}{Added \cs{itshape}.}
1281 % \changes{v1.1v}{2002/10/01}{Use braces around \cs{itshape}
1282 % to keep font change local (pr/3460).}
1283 % The default display for the footnote counter in minipages is to
1284 % use italic letters. We use |\itshape| not |\textit| as the latter
1285 % would add an italic correction.
1287 \@definecounter{mpfootnote}
1288 \def\thempfootnote{{\itshape\@alph\c@mpfootnote}}
1292 % \begin{macro}{\@makefnmark}
1293 % \changes{v1.1i}{1995/05/16}{Now use \cs{textsuperscript}.}
1294 % \changes{v1.1j}{1995/05/18}{Added \cs{normalfont}.}
1295 % \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} to
1296 % \cs{textsuperscript}}
1297 % \changes{v1.1k}{1995/05/20}{Moved \cs{normalfont} back
1298 % and use \cs{@textsuperscript}}
1299 % Default definition.
1301 %\def\@makefnmark{\hbox{$^{\@thefnmark}\m@th$}}
1302 \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\@thefnmark}}}
1306 % \begin{macro}{\textsuperscript}
1307 % \changes{v1.1i}{1995/05/16}{Command added./pr1503}
1308 % \changes{v1.1k}{1995/05/20}{Use \cs{normalfont}.}
1309 % \changes{v1.1l}{1995/05/24}{Use \cs{@textsuperscript}}
1310 % This command provides superscript characters in the current text
1311 % font. It's implementation might change!!!
1313 \DeclareRobustCommand*\textsuperscript[1]{%
1314 \@textsuperscript{\selectfont#1}}
1318 % \begin{macro}{\@textsuperscript}
1319 % \changes{v1.1l}{1995/05/24}{Command added.}
1320 % \changes{v1.1n}{1995/12/05}{Use \cs{ensuremath} for latex/1984.}
1321 % \changes{v1.1m}{1995/12/07}
1322 % {Move \cs{m@th} out of the \cs{ensuremath} for latex/1984.}
1323 % This command should not be used directly, but may be used to define
1324 % other commands |\textsuperscript|, |\@makefnmark|. |#1| should
1325 % always start with a font selection command, to activate the font
1328 \def\@textsuperscript#1{%
1329 {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}
1333 % \begin{macro}{\textsubscript}
1334 % \changes{v1.2a}{2014/12/30}{Command added (latexrelease)}
1337 %<latexrelease>\IncludeInRelease{2015/01/01}%
1338 %<latexrelease> {\textsubscript}{\textsubscript}%
1339 %<*2ekernel|latexrelease>
1343 \DeclareRobustCommand*\textsubscript[1]{%
1344 \@textsubscript{\selectfont#1}}%
1348 % \begin{macro}{\@textsubscript}
1349 % \changes{v1.2a}{2014/12/30}{Command added (latexrelease)}
1352 \def\@textsubscript#1{%
1353 {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}%
1358 %</2ekernel|latexrelease>
1359 %<latexrelease>\EndIncludeInRelease
1360 %<latexrelease>\IncludeInRelease{0000/00/00}%
1361 %<latexrelease> {\textsubscript}{\textsubscript}%
1362 %<latexrelease>\let\textsubscript\@undefined
1363 %<latexrelease>\let\@textsubscript\@undefined
1364 %<latexrelease>\EndIncludeInRelease
1369 \def\@textsubscript#1{%
1370 {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
1373 % \begin{macro}{\footnotesep}
1375 \newdimen\footnotesep
1380 % \begin{macro}{\footnote}
1381 % \changes{LaTeX2.09}{1991/11/01}
1382 % {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
1383 % \cs{footnote}, \cs{footnotemark},
1384 % and \cs{footnotetext}, since \cs{xdef} is used}
1385 % \changes{LaTeX2.09}{1991/11/22}
1386 % {(RmS) Added \cs{let}\cs{protect}\cs{noexpand} in
1387 % \cs{@xfootnote}, \cs{@xfootnotemark},
1388 % and \cs{@xfootnotetext}}
1389 % \changes{LaTeX2.09}{1992/11/26}
1390 % {(RmS) Changed all to
1391 % `def`protect\string{`noexpand`protect`noexpand\string}}
1392 % \changes{v1.1b}{1994/11/26}
1393 % {(ASAJ) Added \cs{protected@xdef}.}
1396 \def\footnote{\@ifnextchar[\@xfootnote{\stepcounter\@mpfn
1397 \protected@xdef\@thefnmark{\thempfn}%
1398 \@footnotemark\@footnotetext}}
1402 % \begin{macro}{\@xfootnote}
1404 \def\@xfootnote[#1]{%
1406 \csname c@\@mpfn\endcsname #1\relax
1407 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1409 \@footnotemark\@footnotetext}
1413 % \begin{macro}{\@footnotetext}
1414 % \changes{LaTeX2.09}{1991/09/29}
1415 % {(RmS) added \cs{reset@font}}
1416 % \changes{LaTeX2.09}{1992/11/26}
1417 % {(RmS) added protection for \cs{edef}}
1418 % \changes{v1.0a}{1994/03/07}
1419 % {(DPC) Extra group for colour}
1420 % \changes{v1.0c}{1994/03/14}
1421 % {(DPC) Use \cs{color@begingroup}, add \cs{endgraf}}
1422 % \changes{v1.0d}{1994/04/18}
1423 % {(DPC) Remove Colour support}
1424 % \changes{v1.0g}{1994/05/13}
1425 % {(DPC) Add new style colour support: \cs{normalcolor}}
1426 % \changes{v1.0g}{1994/05/13}
1427 % {(DPC) Use \cs{@finalstrut}}
1428 % \changes{v1.1a}{1994/10/31}
1429 % {(DPC/CAR) Move colour setting to output routine}
1430 % \changes{v1.1b}{1994/11/04}
1431 % {(ASAJ) Added \cs{protected@edef}.}
1432 % \changes{v1.1c}{1994/11/05}
1433 % {Removed \cs{normalcolor} (again)}
1434 % \changes{v1.1t}{1997/11/19}
1435 % {Missing percent, again}
1437 \long\def\@footnotetext#1{\insert\footins{%
1438 \reset@font\footnotesize
1439 \interlinepenalty\interfootnotelinepenalty
1440 \splittopskip\footnotesep
1441 \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
1442 \hsize\columnwidth \@parboxrestore
1443 \protected@edef\@currentlabel{%
1444 \csname p@footnote\endcsname\@thefnmark
1448 \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
1453 % \begin{macro}{\footnotemark}
1454 % \changes{v1.1b}{1994/11/04}{Added \cs{protected@xdef} to
1455 % \cs{footnotemark}.}
1458 \@ifnextchar[\@xfootnotemark
1459 {\stepcounter{footnote}%
1460 \protected@xdef\@thefnmark{\thefootnote}%
1465 % \begin{macro}{\@xfootnotemark}
1467 \def\@xfootnotemark[#1]{%
1469 \c@footnote #1\relax
1470 \unrestored@protected@xdef\@thefnmark{\thefootnote}%
1476 % \begin{macro}{\@footnotemark}
1477 % \changes{v1.1h}{1995/05/12}
1478 % {Add \cs{nobreak} to allow hyphenation. latex/1605}
1480 \def\@footnotemark{%
1482 \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
1484 \ifhmode\spacefactor\@x@sf\fi
1489 % \begin{macro}{\footnotetext}
1492 \@ifnextchar [\@xfootnotenext
1493 {\protected@xdef\@thefnmark{\thempfn}%
1498 % \begin{macro}{\@xfootnotenext}
1500 \def\@xfootnotenext[#1]{%
1502 \csname c@\@mpfn\endcsname #1\relax
1503 \unrestored@protected@xdef\@thefnmark{\thempfn}%
1509 % \begin{macro}{\thempfn}
1510 % \begin{macro}{\@mpfn}
1512 \def\@mpfn{footnote}
1513 \def\thempfn{\thefootnote}