% P L A C E I N S . S T Y ver 2.0 June 27, 2002 % Donald Arseneau asnd@triumf.ca % Keep floats `in their place'; don't let them float into another section. % Instructions are below. % % placeins.sty is freely released to the public domain. \def\@fb@botlist{\@botlist} \def\@fb@topbarrier{\suppressfloats[t]} \catcode`\V=14 % `V' is a comment character unless [verbose] \@ifundefined{DeclareOption}{}% {\DeclareOption{below}{\def\@fb@botlist{}} \DeclareOption{above}{\def\@fb@topbarrier{}} \DeclareOption{section}{\expandafter\renewcommand\expandafter\section \expandafter{\expandafter\FloatBarrier\section}} \DeclareOption{verbose}{\catcode`\V=9 }% Activate things after `V' \ProvidesPackage{placeins}[2002/06/27 \space v 2.0] \ProcessOptions } \def\FloatBarrier{\par\begingroup \let\@elt\relax \edef\@tempa{\@fb@botlist\@deferlist\@dbldeferlist}% \ifx\@tempa\@empty V\PackageInfo{placeins}{No floats held}% \else \ifx\@fltovf\relax % my indicator of recursion \if@firstcolumn V\PackageWarning{placeins}{Some floats are stuck}% \clearpage \else V\PackageInfo{placeins}{Eject a column and check again:}% \null\newpage\FloatBarrier \fi \else V\PackageInfo{placeins}{Must dump some floats}% \newpage \let\@fltovf\relax V\PackageInfo{placeins}{Check again:}% \FloatBarrier % recurse once only \fi \fi \endgroup \@fb@topbarrier } \AtBeginDocument{\@fb@topbarrier} \catcode`\V=11 \endinput ============== I N S T R U C T I O N S ============== Placeins.sty keeps floats `in their place', preventing them from floating past a "\FloatBarrier" command into another section. To use it, declare "\usepackage{placeins}" and insert "\FloatBarrier" at places that floats should not move past, perhaps before every "\section". [section] A more convenient way to use it is to change the definition of "\section" by placing "\FloatBarrier" before "\@startsection" (see The LaTeX Companion, section 2.3). If you specify "\usepackage[section]{placeins}", then "\section" will be redefined with "\Floatbarrier" inserted at the beginning. [above] [below] Something you may not like is that, by default, "\FloatBarrier" is very strict, and will prevent a float from appearing above the start of the current section or below the start of the next section, even though the float is still on the same page as its intended section. Each restriction can be relaxed separately by using the "[above]" and "[below]" package options. NOTE! The original version of placeins.sty acted like it always had the [above] option specified. Test file integrity: ASCII 32-57, 58-126: !"#$%&'()*+,-./0123456789 :;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~