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!

  • Really the best way of dealing with the auxiliary files is to simply ignore that they are there. – Torbjørn T. Sep 14 '16 at 13:42

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.

  • It's indeed called "Commands" in the English version. – samcarter is at topanswers.xyz Sep 13 '16 at 15:57
  • @Benjamin Desef - I'm not sure I understand. Does that not choose the engine to compile the .tex document? I am reading the TeXstudio: user manual regarding the Commands... – Prevost Sep 13 '16 at 17:34
  • @Prevost: Yes, it does. For example, I've modified my command line to pdflatex.exe -synctex=1 -interaction=nonstopmode -shell-escape --extra-mem-bot=1000000000 %.tex; the first two arguments should be there by default, I introduced the latter ones. And as said in your linked answer, you have to provide -aux-directory=<whatever> instead. The applications are automatically run in the folder of the TeX file, so you can use relative paths. You may also change the command to texify with the option --clean, if you want to delete all auxiliary files afterwards (which I do not recommend). – Benjamin Desef Sep 14 '16 at 8:09
  • @BenjaminDesef - And are you compiling the .tex document using the command line? Or are you compiling via TeXstudio. It sounds like from your answer you are instructing TeXstudio to compile it but it would be equivalent to calling that through the comand line...is this correct? – Prevost Sep 14 '16 at 11:42
  • @BenjaminDesef - when i pdflatex.exe -synctex=1 -interaction=nonstopmode -shell-escape --extra-mem-bot=1000000000 %.tex into the PdfLaTeX Commands in Configure TeXstudio, I receive the error Could not start Build & Videw:PdfLaTeX: pdflatex.exe -synctex=1 -interaction=nonstopmode -shell-escape --extra-mem-bot=1000000000 "Myfilename".tex – Prevost Sep 14 '16 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.