# Welcome to the UK List of TeX Frequently Asked Questions on the Web

## 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 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.

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 in ordinary running text. 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 macros/latex/contrib/bigfoot (or browse the directory); catalogue entry

Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=figurehere

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.26, released on 2013-02-25.