[Tex/LaTex] Global setting to prevent latex from generating additional files with TeXStudio

auxiliary-filescompilingmiktextexstudio

Is there a way to deal with the additional files generated when compiling a .tex file? I have found information here, but it seems you have to compile the .tex file in command line.

I would like to specify the directory for the .aux .soc .log .gz files so that when I compile the .tex document, only the .pdf output is placed in the folder containing the .tex file.

I am using TeXStudio and MiKTeX 2.9.

Thank you!

Best Answer

If you are satisfied with the command line switch provided in your linked page, you can simply tell TeXStudio to use it: In the program options, go to the second section (possibly called Commands - I only have a German version available in which it is called Befehle) and add the command line additions to the PdfLaTeX, LaTeX or XeLaTeX edit, depending on what you are using.

Edit: This is how you do it, but let me just point out why I would discourage you of doing it.

First, you may choose an absolute directory. Then, you should never name two of your TeX files the same or there will be some confusion - if you load different packages, the first run might even fail. So this is a bad idea.

Since the commands are executed within the directory of the TeX file, it is easy to use relative paths. You may (see comment) decide to put it in a subdirectory (build or something similar [note that aux will not work, since it is forbidden as a directory name in Windows]). If the dir does not exist, it will be created automatically. This works nicely most of the times, unless you have some packages which rely on some kind of undisturbed path structure. For example, I did create some commands which allow me to easily split a tikzpicture into multiple smaller subplots. For this, an external file is created and then compiled. If you manually set a different -aux-directory, imports of resources in the externalized file will fail. So this approach has to be taken with care as well.

Related Question