annotate thesis/extraplaceins.sty @ 539:fc116e960f56

more elaboration
author Robert McIntyre <rlm@mit.edu>
date Sun, 27 Apr 2014 21:52:39 -0400
parents f639e2139ce2
children
rev   line source
rlm@510 1 % P L A C E I N S . S T Y ver 2.2 April 18, 2005
rlm@510 2 % Donald Arseneau asnd@triumf.ca
rlm@510 3 %
rlm@510 4 % Modified on March 6, 2011
rlm@510 5 % Lex Fridman lexfridman@gmail.com
rlm@510 6 % See: http://bit.ly/h2Se0u
rlm@510 7 %
rlm@510 8 % Keep floats `in their place'; don't let them float into another section.
rlm@510 9 % Instructions are below.
rlm@510 10 %
rlm@510 11 % placeins.sty is freely released to the public domain.
rlm@510 12
rlm@510 13
rlm@510 14 \def\@fb@botlist{\@botlist}
rlm@510 15 \def\@fb@topbarrier{\suppressfloats[t]}
rlm@510 16
rlm@510 17 \catcode`\V=14 % `V' is a comment character unless [verbose]
rlm@510 18
rlm@510 19 \@ifundefined{DeclareOption}{}%
rlm@510 20 {\DeclareOption{below}{\def\@fb@botlist{}}
rlm@510 21 \DeclareOption{above}{\def\@fb@topbarrier{}}
rlm@510 22 \DeclareOption{section}{\AtBeginDocument{%
rlm@510 23 \expandafter\renewcommand\expandafter\section\expandafter
rlm@510 24 {\expandafter\@fb@secFB\section}%
rlm@510 25 \newcommand\@fb@secFB{\FloatBarrier
rlm@510 26 \gdef\@fb@afterHHook{\@fb@topbarrier \gdef\@fb@afterHHook{}}}
rlm@510 27 \g@addto@macro\@afterheading{\@fb@afterHHook}
rlm@510 28 \gdef\@fb@afterHHook{}
rlm@510 29 }}
rlm@510 30 \DeclareOption{subsection}{\AtBeginDocument{%
rlm@510 31 \expandafter\renewcommand\expandafter\subsection\expandafter
rlm@510 32 {\expandafter\@fb@subsecFB\subsection}%
rlm@510 33 \newcommand\@fb@subsecFB{\FloatBarrier
rlm@510 34 \gdef\@fb@afterHHook{\@fb@topbarrier \gdef\@fb@afterHHook{}}}
rlm@510 35 \g@addto@macro\@afterheading{\@fb@afterHHook}
rlm@510 36 \gdef\@fb@afterHHook{}
rlm@510 37 }}
rlm@510 38 \DeclareOption{subsubsection}{\AtBeginDocument{%
rlm@510 39 \expandafter\renewcommand\expandafter\subsubsection\expandafter
rlm@510 40 {\expandafter\@fb@subsubsecFB\subsubsection}%
rlm@510 41 \newcommand\@fb@subsubsecFB{\FloatBarrier
rlm@510 42 \gdef\@fb@afterHHook{\@fb@topbarrier \gdef\@fb@afterHHook{}}}
rlm@510 43 \g@addto@macro\@afterheading{\@fb@afterHHook}
rlm@510 44 \gdef\@fb@afterHHook{}
rlm@510 45 }}
rlm@510 46 \DeclareOption{verbose}{\catcode`\V=9 }% Activate things after `V'
rlm@510 47 \ProvidesPackage{placeins}[2005/04/18 \space v 2.2]
rlm@510 48 \ProcessOptions
rlm@510 49 } % end of \@ifundefined
rlm@510 50
rlm@510 51 \def\FloatBarrier{\par\begingroup \let\@elt\relax
rlm@510 52 V\edef\@tempa{\write\m@ne{Package placeins Info: Float barrier, from
rlm@510 53 V input line \the\inputlineno, processed on page \thepage, lands on
rlm@510 54 V page \noexpand\thepage. }}\@tempa
rlm@510 55 \edef\@tempa{\@fb@botlist\@deferlist\@dbldeferlist}%
rlm@510 56 \ifx\@tempa\@empty V\PackageInfo{placeins}{No floats held,}%
rlm@510 57 \else
rlm@510 58 \ifx\@fltovf\relax % my indicator of recursion
rlm@510 59 \if@firstcolumn V\PackageWarning{placeins}{Some floats are stuck,}%
rlm@510 60 \clearpage
rlm@510 61 \else V\PackageInfo{placeins}{Eject a column and check again:}%
rlm@510 62 \null\newpage\FloatBarrier
rlm@510 63 \fi
rlm@510 64 \else V\PackageInfo{placeins}{Must dump some floats}%
rlm@510 65 \newpage \let\@fltovf\relax V\PackageInfo{placeins}{Check again:}%
rlm@510 66 \FloatBarrier % recurse once only
rlm@510 67 \fi\fi \endgroup
rlm@510 68 \@fb@topbarrier }
rlm@510 69
rlm@510 70 \catcode`\V=11
rlm@510 71 \endinput
rlm@510 72
rlm@510 73 %====================== BEGIN INSTRUCTIONS ===========================
rlm@510 74
rlm@510 75 p l a c e i n s . s t y ver 2.2 April 18, 2005
rlm@510 76 Donald Arseneau asnd@triumf.ca
rlm@510 77
rlm@510 78
rlm@510 79 Placeins.sty keeps floats `in their place', preventing them from floating
rlm@510 80 past a "\FloatBarrier" command into another section. To use it, declare
rlm@510 81 "\usepackage{placeins}" and insert "\FloatBarrier" at places that floats
rlm@510 82 should not move past, perhaps at every "\section".
rlm@510 83
rlm@510 84 Option: [section]
rlm@510 85
rlm@510 86 A more convenient way to stop floats at section boundaries is to change
rlm@510 87 the definition of "\section" to include "\FloatBarrier", either at the
rlm@510 88 beginning, before "\@startsection", or in the `style' specification (see
rlm@510 89 The LaTeX Companion, section 2.2.2; or 2.3 in the 1st ed). If you specify
rlm@510 90 "\usepackage[section]{placeins}", then the "\section" command will be
rlm@510 91 redefined with "\FloatBarrier" inserted at the beginning.
rlm@510 92
rlm@510 93 Options: [above] [below]
rlm@510 94
rlm@510 95 Something you may not like is that, by default, "\FloatBarrier" is very
rlm@510 96 strict, and will (try to) prevent a float from appearing above the start
rlm@510 97 of the current section or below the start of the next section, even
rlm@510 98 though the float is still on the same page as its intended section.
rlm@510 99 Each restriction can be relaxed separately by using the "[above]" and
rlm@510 100 "[below]" package options: "[above]" allows floats to appear above their
rlm@510 101 section, if on the same page; "[below]" allows below.
rlm@510 102
rlm@510 103 NOTE! The original version of placeins.sty acted like it was loaded
rlm@510 104 with the option "[above]" specified.
rlm@510 105
rlm@510 106 There is a problem with LaTeX's "\suppressfloats" being out of step with
rlm@510 107 the page breaking (see usenet msg <yfi656pbsn0.fsf@triumf.ca> and thread)
rlm@510 108 which sometimes allows a float to go above a "\FloatBarrier" placed near
rlm@510 109 the top of a page. Maybe placeins will fix it sometime later.
rlm@510 110
rlm@510 111 Option: [verbose]
rlm@510 112
rlm@510 113 There is a package option "[verbose]" that causes many messages to be
rlm@510 114 written in the log file. It might be used to answer the question:
rlm@510 115 `How did *that* get *there*?!?'
rlm@510 116
rlm@510 117 %====================== END INSTRUCTIONS ========================
rlm@510 118
rlm@510 119 Test file integrity: ASCII 32-57, 58-126: !"#$%&'()*+,-./0123456789
rlm@510 120 :;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~