Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Force figure placement in text

Quite new to LaTeX so I apologize if this is a rookie/obvious error. I'm trying to include some figures in a college report I'm doing. However, the figures keep popping up all over the place. My source looks something like this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.Curabitur convallis 
augue et nisl eleifend vitae convallis massa ultricies. Cras iaculis sem nec
turpis euismod interdum. Vestibulum eget ligula metus, sit amet pulvinar lorem.

\begin{figure}
\begin{center}
\includegraphics[scale=1]{my_graphic}
\caption{My graphic}
\end{center}
\end{figure}

Sed vulputate ligula non quam congue consectetur. Ut erat massa, lacinia sed 
mattis vitae, pretium nec quam. Pellentesque faucibus hendrerit lacinia. Sed 
in massa erat. Praesent massa mauris, dapibus at euismod at, iaculis 
eleifend nulla.

However, instead of the graphic showing up between the two paragraphs when I build it, it pops up somewhere seemingly randomly nearby. Why is it not appearing between my two paragraphs like I have in my source? Urgently need help solving this, thanks.

share|improve this question
2  
This has been asked several times before. Please use the search function to find previous questions that might possibly answer your question before aksing. –  Thorsten Mar 21 '12 at 17:40
add comment

marked as duplicate by Thorsten, percusse, Gonzalo Medina, Mico, Martin Scharrer Mar 21 '12 at 17:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 0 down vote accepted

The idea of the figure environment is that it places the graphic in a float, i.e. LaTeX determines where best to place the graphic, so that it appears at a suitable position instead of potentially destroying your page layout. If you really want to avoid this, it is easiest to simply not use a figure environment (just the includegraphics command will place the graphic there) or add the option [!h] to the environment.

I'd recommend adding a caption and a reference to the picture instead:

As you can see in \ref{mygraphic} ....

\begin{figure}
\centering
\includegraphics[scale=1]{my_graphic}
\caption{My graphic}
\label{mygraphic}
\end{figure}

That way the graphic will be placed nicely and it's still clear where it fits in your text. See also Should I use center or centering for figures and tables?

share|improve this answer
    
Adding [!h] as a placement specifier can do more harm than good. –  Gonzalo Medina Mar 21 '12 at 17:51
1  
Please no answers to a question which is clearly a duplicate. Also using center is clearly wrong. Use \centering instead. This is also mentioned several times on this site already. –  Martin Scharrer Mar 21 '12 at 17:59
    
@Martin Scharrer: Thank you for pointing out the fact about the center environment! I was yet unaware of it and kept blaming the vertical space on figure. –  Jonathan Mar 22 '12 at 11:10
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.