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:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM