# Formatting issue with includegraphics [duplicate]

I'm new to LaTeX and currently trying to write myself a report template that I can use for future work.

Anyway, here is a MWE showing the error:

\documentclass[12pt,twoside,a4paper]{article}
\usepackage{graphicx}

\begin{document}
\begin{figure}[ht]
\centering
\includegraphics[width=\linewidth]{epsFig}
\caption{This is where a caption would go. Include the image in the folder of the project, the image must have a .eps file format.}
\label{fig:example}
\end{figure}
\end{document}


And the output ends up looking like this:

That is, there's not enough space on the previous page to place the image so it is moved on to the next page, but it ends up at the bottom left of the page covered by the caption.

The image was created using MatLAB, I use TexnicCentre with Miktex2.9. Can anyone help?

edit: The file extension for the image is .eps The image is at this link

• Welcome to TeX.SX! Your example should be alright in terms of the code. In fact: when I run your example using \usepackage[demo]{graphicx} I (fortunately) don't get the figure misplaced as in your document. Hence, I think we need more context here. Are you really running only the given example as it stands? Is your MatLAB plot a pdf? Does it contain whitespace in the top and in the right? Jul 20 '15 at 15:44
• I'm almost sure that the problem is related with the bounding box of the image. Jul 20 '15 at 15:51
• @Ruben What I've included is only a small section of the full thing, I figured that I'd just include the relevant bits. The plot is a .eps, I've done some reading and problems with the file produce by MatLAB seems to be a common issue :(. Thanks for replying. Jul 20 '15 at 17:21
• @Gavin: Consider following these steps: How to fix EPS with incorrect bounding box? That is, you can include the single image as part of a standalone document with border=0pt. This should correct the bounding box, after which you can include the updated image as part of your original document.
– Werner
Jul 20 '15 at 17:38
• clicked the wrong dupe obviously. Jul 20 '15 at 18:55