# tufte handout document class not recognized when compiled in Emacs

I don't understand why tufte handout is not recognized when I compile it in Emacs. The standard tex engine there is xetex. I understand that this might be the key problem but I was unable to figure out how to change that to xelatex. For instance, I can flawlessly compile the file correctly via pdflatex command but when I am using the AUCTeX/Emacs one it doesn't work.

What I tried was the classic C-c C-c trick; and the output that I received was a pdf that wasn't formatted well.

Additionally, an extract from the cat sample.log revealed the following error messages:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdftex 2017.1.28)  4 FEB 2017 08:37entering extended moderestricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\input sample-notes-2.tex
(./sample-notes-2.tex
./sample-notes-2.tex:1: Undefined control sequence.
l.1 \documentclass
{tufte-handout}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.


etc...

    ### simple group (level 2) entered at line 27 ({)
### simple group (level 1) entered at line 27 ({)
### bottom level</usr/share/texlive/texmf-
dist/fonts/type1/public/amsfonts/cm/c
mmi10.pfb></usr/share/texlive/texmf-
dist/fonts/type1/public/amsfonts/cm/cmr10.p
fb></usr/share/texlive/texmf-
dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb>
Output written on sample-notes-2.pdf (1 page, 35223 bytes).
PDF statistics:
26 PDF objects out of 1000 (max. 8388607)
13 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)


So essentially I did get an output one page pdf but the content was a complete mess.

• Does it help if you add the following 5 lines at the end of your file, restart Emacs and open your file again? %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% TeX-engine: xetex %%% End: – Arash Esbati Feb 4 '17 at 9:42
• unfortunately this doesnt help at all. you probably mean after \end{document}. But that would not necessarily make also sense to me. – Charlie Feb 4 '17 at 12:24
• Yes, I meant after \end{document} in 5 separate lines. In your .tex file, what do you see in echo area if you put this (executable-find "xelatex") somewhere, move point after ) and hit C-x C-e? – Arash Esbati Feb 4 '17 at 12:42
• symbol's value as variable is void:error. That is if I understood correctly. – Charlie Feb 4 '17 at 13:28
• You get that result with (executable-find "xelatex")* where * was the cursor as you hit C-x C-e? Hmm, if Emacs doesn't find the binary, you should check the way environment variable PATH is set. It seems to be different in the prompt where you did it with pdflatex. You can check the PATH in Emacs with C-h v exec-path RET. – Arash Esbati Feb 5 '17 at 7:05

\documentclass is defined for the LaTeX format. You're trying to process the LaTeX format with XeTeX. Use XeLaTeX instead:

M-x LaTeX-mode RET  ;; my guess is you mistakenly used 'TeX-mode' here
M-x TeX-engine-set RET xetex RET


Your compilation buffer should look something like this:

Running LaTeX' on temp-file--65261vvi' with xelatex  -file-line-error   -interaction=nonstopmode "\input" temp-file--65261vvi.tex''
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2017/01/01> patch level 1
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(./temp-file--65261vvi.tex
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo))
(./temp-file--65261vvi.aux) [1] (./temp-file--65261vvi.aux) )
Output written on temp-file--65261vvi.pdf (1 page).
Transcript written on temp-file--65261vvi.log.

TeX Output finished at Sat Mar  4 22:21:18
`