Solution for Latex error: "Cannot determine size of graphic"

I'm trying to include graphics in my Latex-file, which I compiled with latex+dvipdf on OS X. Latex however returns this error: "Cannot determine size of graphic"

My graphic is exported from PowerPoint, so I have tried both .pdf and .png. I get the same errors for both.

Sample code:

\begin{figure}[htb]
\begin{center}
\leavevmode
\includegraphics[width=0.8\textwidth]{graph.png}
\end{center}
\end{figure}

Error:

Answers:

 The DVI producing latex doesn't support reading the size of PNG, JPG or PDF images. You need to use pdflatex for this.

Actually latex is pdflatex in DVI mode in modern distributions, but it can read the sizes only in PDF mode for some reason.

You are however able to state the natural size of the images using natwidth and natheight which will make latex compile without error.

The produced DVI file will only link to the PDF and the DVI-to-PDF converter will need to include it in the final PDF.

AFAIK dvpdf doesn't support this but dvipdfm does.

Do it like the picture's method:

posted @ 2015-12-24 15:52  AllenLYU  阅读(5419)  评论(0编辑  收藏  举报
levels of contents