I've been using Emacs + AUCTeX for several years now, and all of a sudden I started getting the follow error on all documents that have compiled fine before:
ERROR: Package pdftex.def Error: PDF mode expected, but DVI mode detected!
This error can be duplicated for me with the following very basic document. From within Emacs I type C-c C-c
and then choose LaTeX
. That's what I've always done, and I assume AUCTeX automatically determined to run pdflatex
command. When I run pdflatex
from the command line, the tex file compiles without errors.
\documentclass{article}
\usepackage[pdftex]{graphicx}
\begin{document}
\end{document}
The error comes from the [pdftex]
. In other words, \usepackage{graphicx}
works just fine without [pdftex]
Specifically, the error comes from pdftex.def:
\ifnum\pdfoutput<1 %
\GPT@error{%
PDF mode expected, but DVI mode detected!\MessageBreak
If you are using `latex', then call `pdflatex'.\MessageBreak
Otherwise check and correct the driver options.\MessageBreak
Error recovery by switching to PDF mode%
}\@ehc
\pdfoutput=1 %
\fi
It seems that \pdfoutput
is not being set to 1, and perhaps for all the time I've used AUXTeX in the past, it was set to 1. What has changed?
I'm using:
- Ubuntu 10.10
- pdfTeX 3.1415926
- AUCTeX 11.85
- Emacs 23.1.1
\pdfoutput
has a different value, but you are trying to force graphicx to load the pdftex driver which will not work with regular latex, it need pdflatex. In any case one never need driver option tographicx
unless one is using dvipdfx (or perhaps xelatex)C-c C-c
I've always only had the LaTeX option which it always seemed to run pdfLaTeX automatically.C-c C-t C-p
turns on the TeX-PDF-mode of AUCTeX and makes the figures build correctly