# How to keep tables and figures where I put them?

 0 How can I convince LaTeX to keep floating environments such as table and figure close to where I write them in the document source code? This question is marked "community wiki". asked 30 Jan, 23:50 stefan ♦♦ 86●2 accept rate: 42%

 1 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: \begin{figure}[!htbp]  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) Example: text \begin{minipage}{\linewidth} \begin{center} \includegraphics[width=.6\linewidth]{example-image} \captionof{figure}{An example image not including a Wombat} \end{center} \end{minipage} 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: Using Imported Graphics in LaTeX and pdfLaTeX by Keith Reckdahl. The interesting part for your question may be Part IV: The Figure Environment beginning on page 55. I originally wrote this text on TeX.SE and share it here. answered 30 Jan, 23:51 stefan ♦♦ 86●2 accept rate: 42%
 toggle preview community wiki:

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Question tags:

×1
×1
×1
×1