% \iffalse meta-comment
%
% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file. 
% 
% This file is part of the LaTeX base system.
% -------------------------------------------
% 
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.2 or later is part of all distributions of LaTeX 
% version 1999/12/01 or later.
% 
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
% 
% \fi
%
% \iffalse
% 
%<*dtx>
          \ProvidesFile{fixltx2e.dtx}
%</dtx>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{fixltx2e}
%<driver>\ProvidesFile{fixltx2e.drv}
% \fi
%         \ProvidesFile{fixltx2e.dtx}
          [2000/09/24 v1.1d fixes to LaTeX]
%
% \iffalse
%<*driver>
 \documentclass{ltxdoc}
 \begin{document}
 \DocInput{fixltx2e.dtx}
 \end{document}
%</driver>
% \fi
%
% \CheckSum{636}
%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
%
%
% \let\package\textsf
%
%
% \GetFileInfo{fixltx2e.dtx}
%
% \title{The \textsf{fixltx2e} package\thanks{This file
%         has version number \fileversion, last
%         revised \filedate.}}
% \author{Frank Mittelbach, David Carlisle}
% \date{\filedate}
%  \maketitle
%
% \begin{abstract}
%    This package provides fixes to \LaTeXe{} which are desirable but
%    cannot be integrated into the \LaTeXe{} kernel directly as they
%    would produce a version incompatible to earlier releases (either
%    in formatting or functionality).
%
%    By providing these fixes in form of a package users can benefit
%    from them without the danger that their documents will fail or
%    produce unexpected results at other sites since the documents
%    contain a clear indication (the |\usepackage| line preferably
%    with a required date) that the fixes are being needed.
% \end{abstract}
%
% \tableofcontents
%
% \newpage
%
% \section{Introduction}
%
% In the newsletter \texttt{ltnews07.tex} which accompanied the
% \LaTeXe{} maintenance release of June 1997 we wrote:
% \begin{quote}
%    Many of the problem reports we receive concerning the standard
%    classes are not concerned with bugs but are suggesting, more or
%    less politely, that the design decisions embodied in them are
%    `not optimal' and asking us to modify them.
%    
%    There are several reasons why we have decided not to make such
%    changes to these files.
%    \begin{itemize}
%    \item However misguided, the current behaviour is clearly what
%    was intended when these classes were designed.  \item It is not
%    good practice to change such aspects of `standard classes'
%    because many people will be relying on them.
%    \end{itemize}
%    
%    We have therefore decided not to even consider making such
%    modifications, nor to spend time justifying that decision.  This
%    does not mean that we do not agree that there are many
%    deficiencies in the design of these classes, but we have many
%    tasks with higher priority than continually explaining why the
%    standard classes for \LaTeX{} cannot be changed.
% \end{quote}
%
% Back then we probably should have said that this decision also
% covers changes to the \LaTeX{} kernel if the change results in
% noticeable differences in the formatting of documents or otherwise
% produces severe incompatibilities between releases. The important
% point to stress here is that ``people rely on the fact that a
% document formatted at one site produces identical output at a
% different site''. By fixing a certain problem in version
% \meta{date}, people making use of the fix will get incorrectly
% formatted documents if they send them to others who still run on a
% version prior to \meta{date}.
%
% In theory one could get around this by adding a line like
% \begin{quote}
% |\NeedsTeXFormat{latex2e}[|\meta{date}|]| 
% \end{quote}
% on top of the document. However this fails for two reasons. Firstly
% most people will not be aware that they make use of a feature or fix
% that is only available in their version of \LaTeX{} and thus do not
% add such a line in their documents. Secondly even if there is such a
% line the receiving site might not be able to upgrade their \LaTeX{}
% in time to process the document properly (the latter is a sad fact
% of life).
%
% By providing the \texttt{fixltx2e} package we hope to help people in
% this respect since if used their documents contain a clear
% indication that special features/fixes are needed and if the
% receiving site does not have the package available (or not available
% with the right version) it is far easier to download and install it
% from some archive than to upgrade \LaTeX{} in a rush.
%
% We will try to maintain the package in a way that it can be used
% with all maintenance releases of \LaTeXe{} so that, if urgently
% needed, people can simply add it to the current directory in case
% they cannot upgrade their \LaTeX{} for whatever reason.
%
% The package is \textbf{NOT} provided so that people can stop
% upgrading their \LaTeX{} system. It will contain only fixes of a
% certain nature, others will still go into the kernel and extensions
% in form of packages and support files will still be added to the
% base system at regular intervals.
%
% \subsection{Usage}
%
% To use this package include the line
% \begin{quote}
%   |\usepackage{fixltx2e}[|\meta{date}|]|
% \end{quote}
% into the preamble of your document where \meta{date} is the date of
% the \texttt{fixltx2e} package that you are using. 
%
% This way your document will produce a warning if processed at a site
% that only has an older version of of this package.
%
% \section{Fixes added for 1999/12/01}
%
% This section describes the all fixes/features that have been added
% to the initial release of the package. If applicable the bug report
% info (see \texttt{bugs.txt}) is given.
%
%
%
%
% \subsection{2-col: 1-col fig can come before earlier 2-col fig 
%            (pr/2346)}
%
%\begin{verbatim}
% >Number:         2346
% >Category:       latex
% >Synopsis:       2-col: 1-col fig can come before earlier 2-col fig
% >Arrival-Date:   Wed Dec 18 15:41:07 1996
% >Originator:     w.l.kleb@larc.nasa.gov (bil kleb)
% >Description:
% as documented in lamport's book, p. 198, concerning figure
% placement, "a figure will not be printed before an earlier
% figure, and a table will not be printed before an earlier
% table."  however, there is a footnote stating, "However,
% in two-column page style, a single-column figure can come before
% an earlier double-column figure, and vice versa."
% 
% this twocolumn behavior is undesireable---at least by me and
% most professional organizations i publish in.  ed snyzter developed
% a hack fix for 2.09 several years ago which links the two
% counters, but i have not run across a similar "fix" for 2e...
% \end{verbatim}
%
% Originally fixed in package \texttt{fix2col} which was merged into
% this package. Documentation and code from this package have been
% merged into this file.
%
% \subsubsection{Notes on the Implementation Strategy}
%
% The standard output routine maintains two lists of floats that have
% been `deferred' for later consideration. One list for single column
% floats, and one for double column floats (which are always
% immediately put onto their deferred list). This mechanism means
% that \LaTeX\ `knows' which type of float is contained in each box
% by the list that it is processing, but having two lists means
% that there is no mechanism for preserving the order between the
% floats in each list.
%
% The solution to this problem consists of two small changes to
% the output routine.
%
% Firstly, abandon the `double column float list' |\@dbldeferlist|
% and change every command where it is used so that instead the
% same |\@deferlist| is used as for single column floats.
% That one change ensures that double and single column floats
% stay in the same sequence, but as \LaTeX\ no longer `knows'
% whether a float is double or single column, it will happily
% insert a double float into a single column, overprinting the
% other column, or the margin.
%
% The second change is to provide an alternative mechanism for
% recording the two column floats. \LaTeX\ already has a compact
% mechanism for recording float information, an integer count register
% assigned to each float records information about the `type' of float
% `figure', `table' and the position information `htp' etc.
%
% The type information is stored in the `high' bits, one bit position
% (above `32') allocated to each float type. The `low' bits store
% information about the allowed positions, one bit each allocated for
% |h t b p|.  In the \LaTeX2.09 system, the bit corresponding to `16'
% formed a `boundary' between these two sets of information, and it
% was never actually used by the system. Ed Sznyter's
% \package{fixfloats} package not unreasonably used this position to
% store the double column information, setting the bit for double
% column floats. Then at each point in the output routine at which a
% float is committed to a certain region, an additional check must be
% made to check that the float is (or is not) double column. If it
% spans the wrong number of columns it is deferred rather than being
% added. 
%
% Unfortunately the bit `16' is not available in \LaTeXe. It is used
% to encode the extra float position possibility `|!|' that was added
% in that system. It would be possible to use position `32' and to
% move the flags for `table', `figure',\ldots\ up one position, to
% start at 64, but this would mean that in principle one less float
% type would be supported, and more importantly is likely to break
% any other packages that assume anything about the output routine
% internals. So here I instead use another mechanism for flagging
% double column floats: By default all floats have depth 0pt.
% This package arranges that double column ones have depth 1sp.
% This information may then be used in the same manner as in
% the \package{fixfloats} package, to defer any floats that are not of
% the correct column spanning type.
%
%
%
% \subsection{Wrong headline for twocolumn (pr/2613)}
%
%\begin{verbatim}
% >Number:         2613
% >Category:       latex
% >Synopsis:       wrong headline for twocolumn
% >Arrival-Date:   Mon Sep 22 16:41:09 1997
% >Originator:     daniel@cs.uni-bonn.de (Daniel Reischert)
% >Description:
% When setting the document in two columns
% the headline shows the top mark of the second column,
% but it should show the top mark of the first column.
% \end{verbatim}
%
% Originally fixed in package \texttt{fix2col} which was merged into
% this package. Documentation and code from this package have been
% merged into this file.
%
% \subsubsection{Notes on the Implementation Strategy}
%
% The standard \LaTeX\ twocolumn system works internally by making
% each column a separate `page' that is passed independently to \TeX's
% pagebreaker. (Unlike say the \package{multicol} package, where all
% columns are gathered together and then split into columns later,
% using |\vsplit|.) This means that the primitive \TeX\ marks that are
% normally used for header information, are globally reset after the
% first column. By default \LaTeX\ does nothing about this.
% A good solution is provided by Piet van Oostrum (building on earlier
% work of Joe Pallas) in his \package{fixmarks} package.
%
% After the first column box has been collected the mark information
% for that box is saved, so that any |\firstmark| can be
% `artificially' used to set the page-level marks after the second
% column has been collected. (The second column |\firstmark| is not
% normally required.) Unfortunately \TeX\ does not provide a direct
% way of knowing if any marks are in the page, |\firstmark| always has a
% value from previous pages, even if there is no mark in this page.
% The solution is to make a copy of the box and then |\vsplit| it
% so that any marks show up as |\splitfirstmark|.
%
% The use of |\vsplit| does mean that the output routine will globally
% change the value of |\splitfirstmark| and
% |\splitbotmark|. The \package{fixmarks} package goes to some trouble
% to save and restore these values so that the output routine does
% \emph{not} change the values. This part of \package{fixmarks} is not
% copied here as it is quite costly (having to be run on every page) and
% there is no reason why anyone writing code using |\vsplit| should
% allow the output routine to be triggered before the split marks have
% been accessed.
%
%
% \subsection{\texttt{\textbackslash @} discards spaces when moving
%             (pr/3039)}
%
%\begin{verbatim}
% >Number:         3039
% >Category:       latex
% >Synopsis:       \@ discards spaces when moving
% >Arrival-Date:   Sat May 22 09:01:06 1999
% >Originator:     asnd@triumf.ca (Donald Arseneau)
% >Description:
% The \@ command expands to \spacefactor\@m in auxiliary files,
% which then ignores following spaces when it is reprocessed.
%\end{verbatim}
%
% \subsection{\texttt{\textbackslash setlength} produces error if
%   used with registers like \texttt{\textbackslash dimen0} (pr/3066)}
%
%\begin{verbatim}
% >Number:         3066
% >Category:       latex
% >Synopsis:       \setlength{\dimen0}{10pt}
% >Arrival-Date:   Tue Jul  6 15:01:06 1999
% >Originator:     oberdiek@ruf.uni-freiburg.de (Heiko Oberdiek)
% >Description:
% The current implementation of \setlength causes an error,
% because the length specification isn't terminated properly.
% More safe:
% \def\setlength#1#2{#1=#2\relax}
%\end{verbatim}
%
% \subsection{\texttt{\textbackslash addpenalty} ruins flush-bottom (pr/3073)}
%
%\begin{verbatim}
% >Number:         3073
% >Category:       latex
% >Synopsis:       \addpenalty ruins flush-bottom
% >Arrival-Date:   Sat Jul 17 05:11:05 1999
% >Originator:     asnd@triumf.ca (Donald Arseneau)
% >Description:
% Just to keep in mind for further development eh?
% A page break at an \addpenalty after \vspace does *not*
% give a flush-bottom page.  (The intent of \addpenalty is
% apparently just to preserve the flush bottom by putting
% the breakpoint `above' the skip.)
%\end{verbatim}
%
%
%
% \StopEventually{}
%
% \section{Implementation}
%
% We require at least a somewhat sane version of \LaTeXe{}. Earlier
% ones where really quite different from one another.
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
%    \end{macrocode}
%
%
%
% \subsection{2-col: 1-col fig can come before earlier 2-col fig 
%              (pr/2346) \\
%             Wrong headline for twocolumn (pr/2613)}
%
% Originally fixed in package \texttt{fix2col} which was merged into
% this package. Code and documentation are straight copies from that
% package.
%
% \subsubsection{Preserving Marks}
%
% This is just a change to the single command |\@outputdblcol|
% so that it saves mark information for the first column and restores
% it in the second column.
%    \begin{macrocode}
\def\@outputdblcol{%
  \if@firstcolumn
    \global\@firstcolumnfalse
%    \end{macrocode}
% Save the left column
%    \begin{macrocode}
    \global\setbox\@leftcolumn\copy\@outputbox
%    \end{macrocode}
%
% Remember the marks from the first column
%    \begin{macrocode}
    \splitmaxdepth\maxdimen
    \vbadness\maxdimen
    \setbox\@outputbox\vsplit\@outputbox to\maxdimen
%    \end{macrocode}
%
% One minor difference from the current \package{fixmarks}, pass the 
% marks through a token register to stop any |#| tokens causing an
% error in a |\def|.
%    \begin{macrocode}
    \toks@\expandafter{\topmark}%
    \xdef\@firstcoltopmark{\the\toks@}%
    \toks@\expandafter{\splitfirstmark}%
    \xdef\@firstcolfirstmark{\the\toks@}%
%    \end{macrocode}
%
% This test does not work if truly empty marks have been inserted, but
% \LaTeX\ marks should always have (at least) two brace groups.
% (Except before the first mark is used, when the marks are empty,
% but that is OK here.)
%    \begin{macrocode}
    \ifx\@firstcolfirstmark\@empty
      \global\let\@setmarks\relax
    \else
      \gdef\@setmarks{%
        \let\firstmark\@firstcolfirstmark
        \let\topmark\@firstcoltopmark}%
    \fi
%    \end{macrocode}
%
% End of change
%    \begin{macrocode}
  \else
    \global\@firstcolumntrue
    \setbox\@outputbox\vbox{%
     \hb@xt@\textwidth{%
        \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
        \hfil
        \vrule \@width\columnseprule
        \hfil
       \hb@xt@\columnwidth{\box\@outputbox \hss}}}%
  \@combinedblfloats
%    \end{macrocode}
% Override current first and top with those of first column if necessary
%    \begin{macrocode}
    \@setmarks
%    \end{macrocode}
% End of change
%    \begin{macrocode}
    \@outputpage
    \begingroup
      \@dblfloatplacement
      \@startdblcolumn
      \@whilesw\if@fcolmade \fi{\@outputpage\@startdblcolumn}%
    \endgroup
  \fi}
%    \end{macrocode}
%
% \subsubsection{Preserving Float Order}
%
% Changes |\@dbldeferlist| to |\@deferlist| are not explicitly noted
% but are flagged by blank comment lines around the changed line.
%
%
%    \begin{macrocode}
\def\end@dblfloat{%
\if@twocolumn
  \@endfloatbox
  \ifnum\@floatpenalty <\z@
    \@largefloatcheck
%    \end{macrocode}
%
%  Force the depth of two column float boxes.
%    \begin{macrocode}
    \global\dp\@currbox1sp %
%    \end{macrocode}
%
% \changes{v1.1d}{2000/09/24}{FMi: use output routine to
%    defer float}
%    Next line assumes that first token of |\end@float| is
%    |\@endfloatbox| so we gobble that.
%    \begin{macrocode}
%    \@cons\@deferlist\@currbox
     \expandafter\@gobble\end@float
%    \end{macrocode}
%    |\@Esphack| is then added by |\@endfloat| above.
%    \begin{macrocode}
  \fi
%    \ifnum \@floatpenalty =-\@Mii \@Esphack\fi
\else
  \end@float
\fi
}
%    \end{macrocode}
%
% Test if the float box has the wrong width. (Actually as noted above
% the test is for a conventional depth setting rather than for the
% width of the float).
%    \begin{macrocode}
\def\@testwrongwidth #1{%
  \ifdim\dp#1=\f@depth 
  \else
    \global\@testtrue
  \fi}
%    \end{macrocode}
%
% Normally looking for single column floats, which have zero depth.
%    \begin{macrocode}
\let\f@depth\z@
%    \end{macrocode}
%
% but when making two column float area, look for floats with 1sp
% depth.
%    \begin{macrocode}
\def\@dblfloatplacement{\global\@dbltopnum\c@dbltopnumber
   \global\@dbltoproom \dbltopfraction\@colht
   \@textmin \@colht
   \advance \@textmin -\@dbltoproom
   \@fpmin \dblfloatpagefraction\textheight
   \@fptop \@dblfptop
   \@fpsep \@dblfpsep
   \@fpbot \@dblfpbot
%    \end{macrocode}
%
%    \begin{macrocode}
   \def\f@depth{1sp}}
%    \end{macrocode}
%
% All the remaining changes are replacing the double column defer list
% or insering the extra test |\@testwrongwidth|\marg{box} at suitable
% places. That is at plces where a box is taken off the deferlist.
%    \begin{macrocode}
\def \@doclearpage {%
     \ifvoid\footins
       \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
       \setbox\@tempboxa\box\@cclv
       \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
       \global \let \@toplist \@empty
       \global \let \@botlist \@empty
       \global \@colroom \@colht
       \ifx \@currlist\@empty
       \else
          \@latexerr{Float(s) lost}\@ehb
          \global \let \@currlist \@empty
       \fi
       \@makefcolumn\@deferlist
       \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
       \if@twocolumn
         \if@firstcolumn
%    \end{macrocode}
%
%    \begin{macrocode}
           \xdef\@deferlist{\@dbltoplist\@deferlist}%
%    \end{macrocode}
%
%    \begin{macrocode}
           \global \let \@dbltoplist \@empty
           \global \@colht \textheight
           \begingroup
              \@dblfloatplacement
%    \end{macrocode}
%
%    \begin{macrocode}
              \@makefcolumn\@deferlist
              \@whilesw\if@fcolmade \fi{\@outputpage
                                        \@makefcolumn\@deferlist}%
%    \end{macrocode}
%
%    \begin{macrocode}
           \endgroup
         \else
           \vbox{}\clearpage
         \fi
       \fi
%    \end{macrocode}
%    the next line is needed to avoid loosing floats in certain 
%    circumstances a single call to the original |\doclearpage|
%    will now no longer output all floats.
% \changes{v1.1d}{2000/09/24}{FMi: ensure \cs{doclearpage}
%     is called again until all floats are output.}
%    \begin{macrocode}
       \ifx\@deferlist\@empty \else\clearpage \fi
     \else
       \setbox\@cclv\vbox{\box\@cclv\vfil}%
       \@makecol\@opcol
       \clearpage
     \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def \@startdblcolumn {%
  \@tryfcolumn \@deferlist
  \if@fcolmade
  \else
    \begingroup
      \let \reserved@b \@deferlist
      \global \let \@deferlist \@empty
      \let \@elt \@sdblcolelt
      \reserved@b
    \endgroup
  \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@addtonextcol{%
  \begingroup
   \@insertfalse
   \@setfloattypecounts
   \ifnum \@fpstype=8
   \else
     \ifnum \@fpstype=24
     \else
       \@flsettextmin
       \@reqcolroom \ht\@currbox
       \advance \@reqcolroom \@textmin
       \ifdim \@colroom>\@reqcolroom
         \@flsetnum \@colnum
         \ifnum\@colnum>\z@
            \@bitor\@currtype\@deferlist
            \@testwrongwidth\@currbox
            \if@test
            \else
              \@addtotoporbot
            \fi
         \fi
       \fi
     \fi
   \fi
   \if@insert
   \else
     \@cons\@deferlist\@currbox
   \fi
  \endgroup
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@addtodblcol{%
  \begingroup
   \@insertfalse
   \@setfloattypecounts
   \@getfpsbit \tw@
   \ifodd\@tempcnta
     \@flsetnum \@dbltopnum
     \ifnum \@dbltopnum>\z@
       \@tempswafalse
       \ifdim \@dbltoproom>\ht\@currbox
         \@tempswatrue
       \else
         \ifnum \@fpstype<\sixt@@n
           \advance \@dbltoproom \@textmin
           \ifdim \@dbltoproom>\ht\@currbox
             \@tempswatrue
           \fi
           \advance \@dbltoproom -\@textmin
         \fi
       \fi
       \if@tempswa
           \@bitor \@currtype \@deferlist
%    \end{macrocode}
%
% not in fixfloats?
%    \begin{macrocode}
          \@testwrongwidth\@currbox
%    \end{macrocode}
%
%    \begin{macrocode}
           \if@test
           \else
              \@tempdima -\ht\@currbox
              \advance\@tempdima
                -\ifx \@dbltoplist\@empty \dbltextfloatsep \else
                                          \dblfloatsep \fi
              \global \advance \@dbltoproom \@tempdima
              \global \advance \@colht \@tempdima
              \global \advance \@dbltopnum \m@ne
              \@cons \@dbltoplist \@currbox
              \@inserttrue
           \fi
       \fi
     \fi
   \fi
   \if@insert
   \else
     \@cons\@deferlist\@currbox
   \fi
  \endgroup
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def \@addtocurcol {%
   \@insertfalse
   \@setfloattypecounts
   \ifnum \@fpstype=8
   \else
     \ifnum \@fpstype=24
     \else
       \@flsettextmin
       \advance \@textmin \@textfloatsheight
       \@reqcolroom \@pageht
       \ifdim \@textmin>\@reqcolroom
         \@reqcolroom \@textmin
       \fi
       \advance \@reqcolroom \ht\@currbox
       \ifdim \@colroom>\@reqcolroom
         \@flsetnum \@colnum
         \ifnum \@colnum>\z@
           \@bitor\@currtype\@deferlist
%    \end{macrocode}
%    We need to defer the float also if its width
%    doesn't fit.
% \changes{v1.1d}{2000/09/24}{FMi: test for wide float was
%    in wrong place}
%    \begin{macrocode}
          \@testwrongwidth\@currbox
%    \end{macrocode}
%
%    \begin{macrocode}
           \if@test
           \else
             \@bitor\@currtype\@botlist
             \if@test
               \@addtobot
             \else
               \ifodd \count\@currbox
                 \advance \@reqcolroom \intextsep
                 \ifdim \@colroom>\@reqcolroom
                   \global \advance \@colnum \m@ne
                   \global \advance \@textfloatsheight \ht\@currbox
                   \global \advance \@textfloatsheight 2\intextsep
                   \@cons \@midlist \@currbox
                   \if@nobreak
                     \nobreak
                     \@nobreakfalse
                     \everypar{}%
                   \else
                     \addpenalty \interlinepenalty
                   \fi
                   \vskip \intextsep
                   \box\@currbox
                   \penalty\interlinepenalty
                   \vskip\intextsep
                   \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi
                   \outputpenalty \z@
                   \@inserttrue
                 \fi
               \fi
               \if@insert
               \else
                 \@addtotoporbot
               \fi
             \fi
           \fi
         \fi
       \fi
     \fi
   \fi
   \if@insert
   \else
     \@resethfps
     \@cons\@deferlist\@currbox
   \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@xtryfc #1{%
  \@next\reserved@a\@trylist{}{}%
  \@currtype \count #1%
  \divide\@currtype\@xxxii
  \multiply\@currtype\@xxxii
  \@bitor \@currtype \@failedlist
  \@testfp #1%
%    \end{macrocode}
%
%    \begin{macrocode}
  \@testwrongwidth #1%
%    \end{macrocode}
%
%    \begin{macrocode}
  \ifdim \ht #1>\@colht
     \@testtrue
  \fi
  \if@test 
    \@cons\@failedlist #1%
  \else
    \@ytryfc #1%
  \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@ztryfc #1{%
  \@tempcnta\count #1%
  \divide\@tempcnta\@xxxii
  \multiply\@tempcnta\@xxxii 
  \@bitor \@tempcnta {\@failedlist \@flfail}%
  \@testfp #1%
%    \end{macrocode}
%
% not in fixfloats?
%    \begin{macrocode}
  \@testwrongwidth #1%
%    \end{macrocode}
%
%    \begin{macrocode}
  \@tempdimb\@tempdima
  \advance\@tempdimb\ht #1%
  \advance\@tempdimb\@fpsep
  \ifdim \@tempdimb >\@colht
    \@testtrue
  \fi
  \if@test
    \@cons\@flfail #1%
  \else
    \@cons\@flsucceed #1%
    \@tempdima\@tempdimb
  \fi}
%    \end{macrocode}
%
%
%
%
%
%
% \subsection{\texttt{\textbackslash @} discards spaces when moving
%             (pr3039)}
%
% \begin{macro}{\@}
% Ensure that |\@m| can't eat spaces. Alternative would be to make
% |\@| robust but that takes more space.
%    \begin{macrocode}
\def\@{\spacefactor\@m{}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{\texttt{\textbackslash setlength} produces error if
%   used with registers like \texttt{\textbackslash dimen0} (pr/3066)}
%
% \begin{macro}{\setlength}
%    Add space after register (|#1|) but only if this is still the
%    original definition. When, for example, \texttt{calc} was already
%    loaded this wouldn't be a good idea any more.
%  \changes{v1.0c}{2000/09/21}{Don't change if definition was
%    modified already}
%    \begin{macrocode}
\def\@tempa#1#2{#1#2\relax}
\ifx\setlength\@tempa
  \def\setlength#1#2{#1 #2\relax}
\fi
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{\texttt{\textbackslash addpenalty} ruins flush-bottom
% (pr/3073)}
%
% \begin{macro}{\addpenalty}
%    Fix provided by Donald (though the original fix was not good enough).
%    \begin{macrocode}
\def\addpenalty#1{%
  \ifvmode
    \if@minipage
    \else
      \if@nobreak
      \else
        \ifdim\lastskip=\z@
          \penalty#1\relax
        \else
          \@tempskipb\lastskip
          \advance \@tempskipb
               \ifdim\prevdepth>\maxdepth\maxdepth\else
%    \end{macrocode}
%    If |\prevdepth| is -1000pt due to |\nointerlineskip| we better
%    not add it!
%  \changes{v1.0c}{2000/09/21}{Don't add \cs{prevdepth} if it is a
%    senile  value!}
%    \begin{macrocode}
                 \ifdim \prevdepth = -\@m\p@ \z@ \else \prevdepth \fi
               \fi
          \vskip -\@tempskipb
          \penalty#1%
          \vskip\@tempskipb
        \fi
      \fi
    \fi
  \else
    \@noitemerr
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
%
% \Finale
%
\endinput
