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


The index of Frequently Asked Questions about TeX is searchable.

Please enter your keyword here:   then press here: ,    or:

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:

  \caption{caption text}

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

  \captionof{figure}{caption text}

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:


and the sequence of float numbers is all correct.

macros/latex/contrib/capt-of (or browse the directory); catalogue entry
macros/latex/contrib/caption (or browse the directory); catalogue entry
macros/latex/contrib/float (or browse the directory); catalogue entry
macros/latex/contrib/here (or browse the directory); catalogue entry
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.27, released on 2013-06-07.