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:

时间: 2024-11-03 21:08:12

Solution for Latex error: "Cannot determine size of graphic"的相关文章

Latex Error cannot determine the size of graphic 报错的解决办法

插入jpg文件老是会报错... 追究了半天,原来是编译的命令又问题,不应该使用 latex ./hello.tex 而应该使用 pdflatex ./hello.tex 下面是我用的测试代码.其中包含了中文字体的测试. \documentclass{article} \usepackage{CJKutf8} \usepackage{graphicx} \begin{document} \begin{CJK}{UTF8}{gkai} 这是一个楷体中文测试,处理简体字. \end{CJK} \beg

Selenium2学习-041-chromedriver:org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status from unexpected alert open

今天在写WebDriver处理弹出框(alert.confirm.prompt)演示实例脚本分发给朋友时,在其执行时未能成功执行,对应的部分错误详情如下: org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status from unexpected alert open (Session info: chrome=53.0.2785.116) (Driver info: chromed

Thinkphp5错误:Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 68 bytes)

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 68 bytes) 1 $users = Db::name('users')->select(); 2 dump($users); 对于大数据量查询结果,其内容超出了memory size,修改代码如下: 1 $users = Db::name('users')->limit(10)->select(); 完美解决!!!

Fatal error: Allowed memory size of 8388608 bytes exhausted

这两天安装bugfree,更换了一个数据量较大的库,结果打开bug详情页要么是空白页,要么就报如题的错误,错误信息还包括C:\wamp\www\bugfree\Include\Class\ADOLite\adodbSQL_drivers\mysql\mysql_driver.inc 506,打开这个mysql_driver.inc也看不出来什么,倒是按照如题的文字可以百度出一些解决方案,一般是如下的内容: php错误提示 Fatal error: Allowed memory size of 8

LaTeX Error: File `slashbox.sty' not found. 解决办法

从这里下载对应的文件,解压后把文件放在C:\Latex\2018\texmf-dist\tex\latex 中. 再打开cmd命令窗口,输入texhash刷新! LaTeX Error: File `slashbox.sty' not found. 解决办法 原文地址:https://www.cnblogs.com/zxhyxiao/p/9356996.html

解决访问 jar 包里面的字体报错:OTS parsing error: incorrect file size in WOFF header

前言:jar 包里面的字体加载,浏览器 console 中报警告信息,这里记录一下解决方案. 附:自己的一个 jar 包源码 https://github.com/yuleGH/querydb 错误问题: 谷歌浏览器 console 中报警告信息: Failed to decode downloaded font: http://localhost:8080/font/element-icons.woff?v=230-rc1 OTS parsing error: incorrect file s

line 352 Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow

OpenCV 使用 createtrackerbar()报错问题 Error Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file c:\build\master_winpack-build-win64-vc15\opencv\modules\highgui\src\window.cpp, line 352 原因 先上图把 这个问题困扰我几个小时,其实是因为多次imshow一张图造

latex之安装宏包及LaTeX Error: File ''xxx.sty'' not Found报错

1. 找出所缺少的宏包, 2.获取所缺宏包,宏包地址. 3.Download  4. 4.1 .解压后放到安装路径下(如:D:\01soft\CTEX\MiKTeX\tex\latex)4.2 .win7 左下角搜索框输入 setting(Admin),reflesh,Yes4.3 .运行.ins文件便可得到.sty文件4.4 .重复步骤3 5. 打开winedt 重新运行 latex之安装宏包及LaTeX Error: File ''xxx.sty'' not Found报错 原文地址:htt

Latex "Error: Extra alignment tab has been changed to \cr. "

Latex 编译时出现 Error: Extra alignment tab has been changed to \cr.  是因为\begin{tabular}后面的参数指定为7列,而实际排了8列数据.