在如下使用LaTeX编译下面的文件类型:
\documentclass[journal,article,pdftex,10pt,a4paper]{IEEEtran}
- 出现如标题所示的Error:
Package pdftex.def Error: PDF mode expected, but DVI mode detected!(pdftex.def) If you are using `latex', then call `pdflatex'. }\@ehc
- 大概是因为
latex
和pdflatex
编译的差异,使用latex
模式,并不能编译后者,查阅相关文档说明:
The option pdftex is for use with pdfLaTeX. If eps figure are used, remove the option pdftex and use LaTeX and dvi2pdf.
- 也就是说,在使用
eps
(内嵌式PostScript)的图片文档时,应该选用latex
模式,而使用pdftex
时就会出问题(解决办法可以尝试把pdftex
删掉)。
另外看到网友,在如下用法下也会出现同样的问题:
\usepackage[pdftex]{graphicx}
- 解决办法是,把
[pdftex]
移除掉,graphicx
包就能正常编译,而在pdftex
模式下,最好把.eps
文件转为.pdf
格式文件。
如果使用例如\includegraphics{file}
这样的命令加载显示图片文件时,前面提到的两种模式都会自动补全文件file
的拓展名,latex
模式会补为file.eps
, 而pdftex
则会补全为file.pdf
(或者file.png
, file.jpg
)。