Tables and figures have a tendency to surprise, by floating
away from where they were specified to appear. This is in fact
perfectly ordinary document design; any professional typesetting
package will float figures and tables to where they'll fit without
violating the certain typographic rules. Even if you use the
placement specifier h
for 'here', the figure or table will not be
printed 'here' if doing so would break the rules; the rules themselves
are pretty simple, and are given on page 198, section C.9 of the
LaTeX manual. In the worst case, LaTeX's rules can cause the
floating items to pile up to the extent that you get an error message
saying
"Too many unprocessed floats".
What follows is a simple checklist of things to do to solve these
problems (the checklist talks throughout about figures, but applies
equally well to tables, or to "non-standard" floats defined by the
float or other packages).
[H]
placement option offered by the float package:
figures with this placement are made up to look as if they're
floating, but they don't in fact float. Beware outstanding floats,
though: the \caption
commands are numbered in the order they
appear in the document, and a [H]
float can 'overtake' a float
that hasn't yet been placed, so that figures numbers get out of
order.
tbp
) is reasonable, but you can reasonably change it (for
example, to add an h
). Whatever you do, don't
omit the 'p
': doing so could cause LaTeX to believe that if you
can't have your figure here, you don't want it
anywhere. (LaTeX does try hard to avoid being confused in
this way...)
\renewcommand{\topfraction}{.85} \renewcommand{\bottomfraction}{.7} \renewcommand{\textfraction}{.15} \renewcommand{\floatpagefraction}{.66} \renewcommand{\dbltopfraction}{.66} \renewcommand{\dblfloatpagefraction}{.66} \setcounter{topnumber}{9} \setcounter{bottomnumber}{9} \setcounter{totalnumber}{20} \setcounter{dbltopnumber}{9}The meanings of these parameters are described on pages 199-200, section C.9 of the LaTeX manual.
\clearpage
command? If so, do: the backlog of floats is
cleared after a \clearpage
. (Note that the \chapter
command in the standard book and report classes
implicitly executes \clearpage
, so you can't float past
the end of a chapter.)
\FloatBarrier
command beyond which floats may not pass. A
package option allows you to declare that floats may not pass a
\section
command, but you can place \FloatBarrier
s wherever
you choose.
afterpage
package.
Its documentation gives as an example the idea
of putting \clearpage
after the current page (where it
will clear the backlog, but not cause an ugly gap in your text), but
also admits that the package is somewhat fragile. Use it as a last
resort if the other two possibilities below don't help.