2

How can I add (in TeXstudio and Windows) an output directory for all those (un-)necessary files (I don't need 'em, LaTeX does: .aux, .glo, .idx, .log, ...) and automatically create this directory if it doesn't exist?

The pdf file can/should remain in the same directory as the main .tex file.

  • Don't do this: it is much better to leave the the output where it should be, in the current directory. – Joseph Wright Sep 25 '15 at 7:48
  • I don't like it that way. "Much better", how? – gilu Sep 25 '15 at 7:50
  • 1
    TeX's model for looking for input is all based around the current directory. If you use an output dir, you can get in to all sorts of issues when for example doing epstopdf, writing customised files and reading back, ... – Joseph Wright Sep 25 '15 at 8:02
  • Ok, I understand your concern. To me, I only use the bascis, this works :-) Maybe when I run into trouble I'll think about your comment - Thank you! – gilu Sep 25 '15 at 8:52
3

Follow these few steps:

  1. Create a batch file containing the command mkdir _output, which will create a folder named _output when run. Change _output to whatever name you like in both in this step and below. Save the batch file in a known and easy to access location.
  2. Add the folder containing the batch file to TeXstudio: Options -> Configure TeXstudio -> Build (you might need to enable advanced options), Commands ($PATH). See screenshot below.
  3. Add your output folder name to Log File under Additional Search Paths.
  4. Create a new User Command and enter the name of the batch file (not the full path) in the right-hand side of the row.
  5. In Meta Commands, add this newly created user command to Precompile.
  6. Add --aux-directory=_output to the end of PdfLaTeX command in Commands.

You're done! Enjoy a tidy tex-directory where all the "junk" is in the output directory. Only the .gz file remains in the tex-directory.

TeXstudio Configuration

I hope someone finds this useful...

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.