# Passing aux directory option to AUCTeX

I use Emacs and MikTeX. With the latter comes a `PDFLaTeX` option to move clutter in a `temp-dir` directory: `-aux-directory temp-dir`. I am tentatively trying to pass it to AUCTeX with:

``````(setq tex-start-options "-aux-directory temp-dir")
``````

Doesn’t work! I am not very knowledgeable with AUCTeX internals. Can you give some hints and examples on `LaTeX-command`, `latex-run-command`, `tex-start-options` and `tex-start-commands` and the likes?

-
You can use latexmk with AUCTeX and pass the pdflatex option via the .latexmkrc file. –  N.N. Jan 22 '13 at 17:56
@N.N. Can you tell me what are the benefits of using Latexmk over simple Emacs/AUCTeX? Isn’t AUCTeX already an interface between Emacs and the LaTeX binaries? Isn’t it possible to do in Elisp what Latexmk does in perl? –  antonio Jan 22 '13 at 20:01
AUCTeX is such an interface and I have not that much experience with it as I have used latexmk via it instead, so I can't really say. latexmk works well (compiles as many times as needed for everything to be done) and it easy to configure. –  N.N. Jan 22 '13 at 20:56
I don't know any `-aux-directory` option for `pdflatex`, however you can set additional options to `pdflatex` customizing `LaTeX-command` variable: `M-x add-file-local-variable RET LaTeX-command RET` and set its value to `"latex -aux-directory temp-dir"` with `""` quotes and without `pdf` before `latex`, it'll be automatically prefixed if `TeX-PDF-mode` is on. –  giordano Jun 2 '13 at 12:59