UK TeX FAQ -- question label figurehere

### Figure (or table) exactly where I want it

This is of course a contradiction: `figure` and `table` are designed to float, and will always have the potential to appear away from where you asked for them. Therefore you need something that behaves like a `figure` or `table` environment, except that it doesn’t allow the figure or table to float.

The most straightforward way is to use of the float package; it gives 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 suggests, such a ‘`[H]`’ figure (or corresponding table) offers all you need to cross-reference as well as typeset. (The package here provides the same function, but is no longer recommended.)

However, you don’t actually have to use float (or here) since it is, in fact, doing rather little for you. You can place your figure as you please, with a sequence like

>     \begin{center}
>       \includegraphics{foo}
>       \captionof{figure}{caption text}
>       \label{fig:nonfloat}
>     \end{center}

which relies on the `\``captionof` command to place a caption without benefit of an enclosing float. That command may be had from the extremely simple-minded package capt-of or from the highly sophisticated caption package.

Using either method, you have to deal with the possibility of the figure or table being too large for the page. (Floating objects will float away in this circumstance; “doing it by hand”, like this, you take upon yourself the responsibility for avoiding ‘Overfull `\``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.

`capt-of.sty`
  macros/latex/contrib/capt-of (or browse the directory); catalogue entry
`caption.sty`
  macros/latex/contrib/caption (or browse the directory); catalogue entry
`float.sty`
  macros/latex/contrib/float (or browse the directory); catalogue entry
`here.sty`
  macros/latex/contrib/here (or browse the directory); catalogue entry
`perpage.sty`
  Distributed as part of macros/latex/contrib/bigfoot (or browse the directory); catalogue entry

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=figurehere