# AUCTeX/LaTeX - ERROR: Undefined control sequence. documentclass

I am using AUCTeX with the following configuration.

(require 'tex)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master "main")
(setq latex-run-command "pdflatex")


Trying to build my document with C-c C-a gives me the error

ERROR: Undefined control sequence.

--- TeX said ---
l.1 \documentclass{IEEEtran}


My main.tex file looks like this:

\documentclass{IEEEtran}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[ngerman]{babel}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{import}
\usepackage{url}
\def\UrlBreaks{\do\/\do-}
\renewcommand\_{\textunderscore\allowbreak}

\begin{document}

\title{foo bar}
\author{foo}
\maketitle

\begin{abstract}
\end{abstract}

\begin{IEEEkeywords}
Blockchain
\end{IEEEkeywords}

% Einleitung
\import{./}{intro.tex}

\nocite{*}
\bibliographystyle{unsrt}

\bibliography{references}

\end{document}


Using pdflatex on the terminal is just working fine.

Why does my emacs say different? I though internally is just a pdflatex call and... violá.

• Which version of AUCTeX do you have (C-h v AUCTeX-version RET) and how did you install it? I suggest you install the latest version via ELPA, drop the lines (require 'tex) and (setq latex-run-command "pdflatex") in your .emacs and try it again. You can also check the output buffer with C-c C-l to see how TeX was invoked. – Arash Esbati Jan 31 '17 at 6:37
• The message would imply that you tried to process the contents of the file with pure TeX, not LaTeX (documentclass is a LaTeX macro). I don't think you are using pdflatex from Emacs when you compile your document. Probably it just calls to something that knows how to process just TeX. – wvxvw Jan 31 '17 at 7:55
• thanks this C-c C-l really did the thing. pdflatex was not correctly included into my path in emacs. – Daniel Hitzel Jan 31 '17 at 12:10