[Tex/LaTex] Keeping tables/figures close to where they are mentioned


Is there any package or a method to force LaTeX to keep floating environments like table and figure closer to where they are declared?

Best Answer

Easing the float placement by options:

You could use more positioning options. Not just [h]. If you wish to place the figure near, allow more positioning options, for instance by [htbp] (here, top, bottom, page). Use a ! symbol to remove further restrictions. So, in many cases this is sufficient:


Useful package regarding float placement:

  • float introduces a placement option H enforcing the placement exactly at that point.
  • placeins provides the command \FloatBarrier to limit the floating of figures or tables. You could place such a barrier before and after a listing.
  • afterpage allows a more clever \clearpage, putting the effect off until the page is full: \afterpage{\clearpage}

Completely avoiding a floating environment:

Package caption allows to add a caption outside a floating environment, meaning at any place you want. Use \captionof{figure}{the caption} (for figures)


\captionof{figure}{An example image not including a Wombat}
even more text

The minipage keeps graphic and caption together, the center environment add a bit of white space around the figure.

Further reading:

Because it's an important and not easy subject, there's a lot of material to be found, for instance in FAQ collections. There's an extensive document dealing with graphics inclusion, manipulation and placement:

The interesting part for your question may be Part IV: The Figure Environment beginning on page 55.

There is also Frank Mittelbach's excellent answer describing the floating mechanism and related options in great detail:

Related Question