Department of Engineering

IT Services

Hints about tables and figures in LaTeX

Moving tables and figures in LaTeX

(from the TeX Users Group FAQ)

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"; this means that the limited set of registers in which LaTeX stores floating items is full. 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).

  • Are the placement parameters on your figures right? The default (tbp) is reasonable; you should never simply say `h', for example, since that says "if it can't go here, it can't go anywhere", and as a result all subsequent floats pile up behind it.
  • Can you perhaps prevent your figures from floating by adjusting LaTeX's placement parameters? Again, the defaults are reasonable, but can be overridden in case of problems. The parameters are described on pages 199-200, section C.9 of the LaTeX manual (or see the next section)
  • Are there places in your document where you could `naturally' put a \clearpage command? If so, do: the backlog of floats is cleared after a \clearpage. (Note that the \chapter command implicitly executes \clearpage, so you can't float past the end of a chapter.)
  • Have a look at the LaTeX afterpage package (part of 2etools). 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 (though it's improving).
  • As a last resort, try the package morefloats; this 'simply' increases the number of floating inserts that LaTeX can handle at one time (from 18 to 36), but that may suit your needs.
  • If you actually wanted all your figures to float to the end (e.g., for submitting a draft copy of a paper), don't rely on LaTeX's mechanism: get the package endfloat to do the job for you.

by Donald Arseneau, Piet van Oostrum et al from comp.text.tex

More tables and graphics on a page

By default, LaTeX only allows up to 3 floats taking up to 0.7 of the page to be on a text page. There are no such limits on figures placed on a `float page' (a page with floats but no regular text), but LaTeX will not create a float page unless it can cover half of it with floats. This behaviour can be changed by placing lines like the following before \begin{document}


The following variables control the vertical spacing with figures

\floatsep     separation between floats on a page with text
\intextsep    separation between floats and the text

plus the hidden parameters for float pages:

\@fptop       space at top of float page
\@fpbot       space at bottom of float page
\@fpsep       space between floats on a float page

The vertical space between a graphic and the caption below it is \abovecaptionskip (10pt default) and the vertical space below a caption is \belowcaptionskip (0pt).