[Tex/LaTex] LaTeX – Image not showing up

graphicspdf

I am writing up some coursework using LaTeX, and I wanted to import a diagram, however when I did the image did not appear in the compiled pdf. The image has been exported as a eps file, and also as a pdf, both of which had the same result. (Although the PDF also required me to provide bounding box figures, as latex couldn't fetch them from the file). I am including the graphic like this:

\documentclass[10pt]{article}
\usepackage[dvips]{geometry,color,graphicx}
\geometry{a4paper}
\begin{document}
\begin{figure}[ht!]
    \centering
    \includegraphics[width=300pt]{figure.eps}
    \caption{caption}
    \label{label}
\end{figure}
\end{document}

Best Answer

Delete [dvips] and .eps then your example should work with latex (using the eps version) or pdflatex (using the pdf version) If it doesn't work it is presumably a problem with the image, but as a test use

\fbox{\includegraphics{figure}} 

so latex puts a visible box around the space where it thinks the image is, if that box is wrong, suspect the boundingbox in the eps file.


The dvips driver can include EPS files but not PDF and the pdftex engine used by pdflatex can include PDF files but not EPS. If you use [dvips] explicitly LaTeX will set things up for dvips so it will not work if you process the document with pdflatex. If you omit the option and the file extension, then a default option is taken depending on the engine used ([dvips] if you use latex and [pdftex] if you use pdflatex. In each case a default list of file extensions is defined, so if you do not put an explicit .eps extension in \includegraphics but have both .eps and .pdf available, latex will try figure.eps and pdflatex will try figure.pdf