在如下使用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)。