# Text floats over figure in latex

I just need to insert a figure in the latex document I am writing -nothing big.Problem is the text keeps floating over the figure and the figure is not centered.Here is my code

\begin{figure}[h!]
\begin{center}
\resizebox{20pt}{!}{\includegraphics{FigureStereo.jpg}}
\caption{Epipolar Geometry}
\label{fig:cclogo}
\end{center}
\end{figure}

• In standard LaTeX this is usually caused by a wrong %BoundingBox in the (e)ps file included, but since you are using pdflatex w/ a JPG file this should not happen. – Marco Lombardi Jun 1 '11 at 22:17
• I don't quite understand. Do you mean that the text is put on top of the image? Please add a minimal working example (MWE) that illustrates your problem. – Caramdir Jun 1 '11 at 22:52
• Use \centering instead of the center environment. The \resizebox{20pt}{!}{\includegraphics{FigureStereo.jpg}} can also be written as \includegraphics[width=20pt]{FigureStereo.jpg}. – Martin Scharrer Jun 2 '11 at 9:50

Your image might have the wrong bounding box information stored which makes LaTeX think it is smaller than it is. You could test it by using \frame{\includegraphics[width=20pt]{FigureStereo.jpg}} and see where the frame is drawn. Maybe opening the image in an image editor and saving it again will fix it.

If a wrong height is used you could add some vertical space to compensate for that. You need to try which amount is right:

\begin{figure}[h!]
\centering
\vspace{20pt}%
\includegraphics[width=20pt]{FigureStereo.jpg}
\caption{Epipolar Geometry}
\label{fig:cclogo}
\end{figure}

\begin{figure*}
\centering
\includegraphics[scale=0.75]{Set2.png}
\caption{
Write the caption of the figure here.
}
\label{fig:obsssn}
\end{figure*}


Adding an star to the name of the element in latex does the work. This is because figure* creates a float environment for the figure in question which spans 2 columns. The element is centered on the page.

• Welcome to TeX.SE! Can you please explain why the * does this? Perhaps you can complete your code snippet to be compilable and add then an screenshot to your answer ... – Mensch Jan 14 at 17:33

Have you tried putting the graphic in a tabular environment, inside the figure?

\begin{figure}
\begin{tabular}{c}
\includegraphics[width=20pt]{FigureStereo.jpg}
\end{tabular}
\caption{Epipolar Geometry}
\label{fig:cclogo}
\end{figure}

• and why should a tabular here make sense? – user2478 Jul 15 '11 at 21:13
• Don't know, the poster never responded if it helped or not. – Justin Bailey Jul 15 '11 at 22:55