0

Possible Duplicate:
Keeping tables/figures close to where they are mentioned

I'm having troubles positioning some images. Some appear where i want them to, others appear right at the end of the document.

\begin{figure}[h]
 \centering
 \includegraphics[width=0.8\textwidth]{images/cleanity.jpg}\\
 \caption{Rapid Application Development (RAD) Model}\label{fig:sift_ex}
\end{figure}

I have a bunch of subheadings and my bibliography after this code, but the image appears after. What am i doing wrong?

David Carlisle
  • 757,742

1 Answers1

0

Figures float - LaTeX puts them where it thinks best. The [h] directive for "here" is only your suggestion, In this case it won't fit and can't go anywhere else, so LaTeX put it at the end of the document. (See comment below.)

You can force the image to be "here" if you just include it, centered, followed by its caption - but then it won't appear in the List of Figures, and it may leave lots of white space on the page or the next page. If you have to have the caption, a possible hack would be to include the image just centered, then create a Figure with just a caption. That might be small enough so that LaTeX would put it where you want it. A better TeX wizard than I might well have a better answer.

See this wikibooks page

Ethan Bolker
  • 9,333
  • 3
  • 42
  • 69
  • @Werner I should have waited for your comment above. – Ethan Bolker Apr 03 '12 at 17:19
  • 1
    saying that latex thinks the end of document is best is misleading. It goes to the end of the document as [h] prevents the float being placed at the top of any page [t] or on a float page [p] so most of the time it won;t fit "here" (because that point is too far down the page) so the float can not be placed anywhere so is dumped at the end as emergency error recovery. – David Carlisle Apr 03 '12 at 17:21
  • @DavidCarlisle Thanks. You taught me more about the position specifiers, and have edited the answer appropriately. – Ethan Bolker Apr 03 '12 at 18:39