Mercurial > cortex
view 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 |
line wrap: on
line source
1 % P L A C E I N S . S T Y ver 2.2 April 18, 20052 % Donald Arseneau asnd@triumf.ca3 %4 % Modified on March 6, 20115 % Lex Fridman lexfridman@gmail.com6 % See: http://bit.ly/h2Se0u7 %8 % Keep floats `in their place'; don't let them float into another section.9 % Instructions are below.10 %11 % placeins.sty is freely released to the public domain.14 \def\@fb@botlist{\@botlist}15 \def\@fb@topbarrier{\suppressfloats[t]}17 \catcode`\V=14 % `V' is a comment character unless [verbose]19 \@ifundefined{DeclareOption}{}%20 {\DeclareOption{below}{\def\@fb@botlist{}}21 \DeclareOption{above}{\def\@fb@topbarrier{}}22 \DeclareOption{section}{\AtBeginDocument{%23 \expandafter\renewcommand\expandafter\section\expandafter24 {\expandafter\@fb@secFB\section}%25 \newcommand\@fb@secFB{\FloatBarrier26 \gdef\@fb@afterHHook{\@fb@topbarrier \gdef\@fb@afterHHook{}}}27 \g@addto@macro\@afterheading{\@fb@afterHHook}28 \gdef\@fb@afterHHook{}29 }}30 \DeclareOption{subsection}{\AtBeginDocument{%31 \expandafter\renewcommand\expandafter\subsection\expandafter32 {\expandafter\@fb@subsecFB\subsection}%33 \newcommand\@fb@subsecFB{\FloatBarrier34 \gdef\@fb@afterHHook{\@fb@topbarrier \gdef\@fb@afterHHook{}}}35 \g@addto@macro\@afterheading{\@fb@afterHHook}36 \gdef\@fb@afterHHook{}37 }}38 \DeclareOption{subsubsection}{\AtBeginDocument{%39 \expandafter\renewcommand\expandafter\subsubsection\expandafter40 {\expandafter\@fb@subsubsecFB\subsubsection}%41 \newcommand\@fb@subsubsecFB{\FloatBarrier42 \gdef\@fb@afterHHook{\@fb@topbarrier \gdef\@fb@afterHHook{}}}43 \g@addto@macro\@afterheading{\@fb@afterHHook}44 \gdef\@fb@afterHHook{}45 }}46 \DeclareOption{verbose}{\catcode`\V=9 }% Activate things after `V'47 \ProvidesPackage{placeins}[2005/04/18 \space v 2.2]48 \ProcessOptions49 } % end of \@ifundefined51 \def\FloatBarrier{\par\begingroup \let\@elt\relax52 V\edef\@tempa{\write\m@ne{Package placeins Info: Float barrier, from53 V input line \the\inputlineno, processed on page \thepage, lands on54 V page \noexpand\thepage. }}\@tempa55 \edef\@tempa{\@fb@botlist\@deferlist\@dbldeferlist}%56 \ifx\@tempa\@empty V\PackageInfo{placeins}{No floats held,}%57 \else58 \ifx\@fltovf\relax % my indicator of recursion59 \if@firstcolumn V\PackageWarning{placeins}{Some floats are stuck,}%60 \clearpage61 \else V\PackageInfo{placeins}{Eject a column and check again:}%62 \null\newpage\FloatBarrier63 \fi64 \else V\PackageInfo{placeins}{Must dump some floats}%65 \newpage \let\@fltovf\relax V\PackageInfo{placeins}{Check again:}%66 \FloatBarrier % recurse once only67 \fi\fi \endgroup68 \@fb@topbarrier }70 \catcode`\V=1171 \endinput73 %====================== BEGIN INSTRUCTIONS ===========================75 p l a c e i n s . s t y ver 2.2 April 18, 200576 Donald Arseneau asnd@triumf.ca79 Placeins.sty keeps floats `in their place', preventing them from floating80 past a "\FloatBarrier" command into another section. To use it, declare81 "\usepackage{placeins}" and insert "\FloatBarrier" at places that floats82 should not move past, perhaps at every "\section".84 Option: [section]86 A more convenient way to stop floats at section boundaries is to change87 the definition of "\section" to include "\FloatBarrier", either at the88 beginning, before "\@startsection", or in the `style' specification (see89 The LaTeX Companion, section 2.2.2; or 2.3 in the 1st ed). If you specify90 "\usepackage[section]{placeins}", then the "\section" command will be91 redefined with "\FloatBarrier" inserted at the beginning.93 Options: [above] [below]95 Something you may not like is that, by default, "\FloatBarrier" is very96 strict, and will (try to) prevent a float from appearing above the start97 of the current section or below the start of the next section, even98 though the float is still on the same page as its intended section.99 Each restriction can be relaxed separately by using the "[above]" and100 "[below]" package options: "[above]" allows floats to appear above their101 section, if on the same page; "[below]" allows below.103 NOTE! The original version of placeins.sty acted like it was loaded104 with the option "[above]" specified.106 There is a problem with LaTeX's "\suppressfloats" being out of step with107 the page breaking (see usenet msg <yfi656pbsn0.fsf@triumf.ca> and thread)108 which sometimes allows a float to go above a "\FloatBarrier" placed near109 the top of a page. Maybe placeins will fix it sometime later.111 Option: [verbose]113 There is a package option "[verbose]" that causes many messages to be114 written in the log file. It might be used to answer the question:115 `How did *that* get *there*?!?'117 %====================== END INSTRUCTIONS ========================119 Test file integrity: ASCII 32-57, 58-126: !"#$%&'()*+,-./0123456789120 :;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~