figure
and
table
are designed to float, and will always have
the potential to appear away from where you asked for them. Therefore
you have to find a means of getting the caption and other effects
without allowing the figure or table to float.
The most straightforward way is to use one of the float or
here packages; they give you a [H]
float placement
option that prevents floating:
\begin{figure}[H] \centering \includegraphics{foo} \caption{caption text} \label{fig:nonfloat} \end{figure}
As the example shows, these [H]
figures (and correspondingly,
tables) offer all you need to cross-reference as well as typeset.
\begin{center} \includegraphics{foo} \captionof{figure}{caption text} \label{fig:nonfloat} \end{center}
which relies on the \
captionof
command to place a caption in
ordinary running text. That command may be had from the extremely
simple-minded package capt-of or from the highly
sophisticated caption package.
\
vbox
’ errors.
A further problem is the possibility that such “fixed floats” will
overtake “real floats”, so that the numbers of figures will be out
of order: figure 6 could be on page 12, while figure 5 had floated to
page 13. It’s best, therefore, either to stay with floating figures
throughout a document, or to use fixed figures throughout.
If it’s really impossible to follow that counsel of perfection, you
can use the perpage package’s command \
MakeSorted
command:
... \usepackage{float} \usepackage{perpage} \MakeSorted{figure} \MakeSorted{table} ...
and the sequence of float numbers is all correct.
This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=figurehere