How to apply aux directory to MiKTeX: putting *.aux files in separate folder [duplicate]

This is a rookie follow up question to the question here: Need *.aux file in separate folder

The answer says: "In MiKTeX you can additionally set `--aux-directory=dir` which will put only the auxiliary files in this directory."

How do I apply this `--aux-directory=dir` to MiKTeX? Do I put it in the preamble of my document? I can't get the interpreter to parse it.

Thanks! David

T.D. - I use TeXShop, which is the normal Mac build I believe. I have put that code everywhere I can think of in the options, the most promising looking spots were in the screen below. Sadly, no love - it obstinately continues to put the aux files next to each of my .tex files (in all folders, which is what I'm trying to avoid).

Any TeXShop users have any ideas? Thanks!

marked as duplicate by Mensch, darthbith, Svend Tveskæg, user31729, R. SchumacherSep 14 '15 at 18:15

• You have to use it like `pdflatex --aux-directory="dir" texfile` – user11232 Feb 4 '15 at 15:41
• Which editor do you use? – Bernard Feb 4 '15 at 15:59
• Hi Bernard, I use TeXShop. Per my comment below, I'm feeling very slow here but it still won't play ball. So my tex and latex fields now read `pdftex --aux-directory=auxfiles --file-line-error --synctex=1` and `pdflatex --aux-directory=auxfiles --file-line-error --synctex=1` . I have a subdirectory in the same folder as the main.tex file I am compiling called `auxfiles`, however it continues to put all the files in the root folder (and next to the .tex files in their respective subfolders). Any ideas? – – David Feb 5 '15 at 12:31

If you compile directly in the command line, you just have to do as Harish Kumar said. If you use an editor like TeXniccenter, TeXstudio or TeXmaker, you will have to add `--aux-directory=dir` in the compilation chain, which can be found in the program’s options.

This is a screenshot of TeXmaker:

(It should be the same kind in other editors.)

You just write `--aux-directory=dir` after (or before) `-interaction=nonstopmode`.

Be careful! In this screenshot, several commands are separated with the `|` character.

• Thank you T.D. for your comprehensive answer, I really appreciate it. I use TeXShop and sadly couldn't get it to work - see screenshot above. Any ideas? – David Feb 4 '15 at 21:44
• In the “pdfTeX” frame, you have two fields: one begining with `pdfTeX` and the other with `pdfLaTeX`. You can write `--aux-directory=dir just just after these commands and before `--file-line-error`. – Zoxume Feb 5 '15 at 9:58
• Thanks T.D. - I'm feeling very slow here but it still won't play ball. So my `tex` and `latex` fields now read `pdftex --aux-directory=auxfiles --file-line-error --synctex=1` and `pdflatex --aux-directory=auxfiles --file-line-error --synctex=1` . I have a subdirectory in the same folder as the `main.tex` file I am compiling called `auxfiles`, however it continues to put all the files in the root folder (and next to the .tex files in their respective subfolders). Any ideas? – David Feb 5 '15 at 10:41

Judging from your screenshot, you are using TeXShop on a Mac with MacTeX. The --aux-directory option is MiKTeX specific, and no equivalent exists in MacTeX.