If it doesn't exist, I would like to automatically create the subfolder ./temp where to put the auxiliary files with -aux-directory=temp. Can this be done in Texstudio 2.10.2?

(see here and the links there to check how to change the directory of the auxiliary files and/or output).


The accepted answer works just fine in case there is no bibliography. However, Texstudio returns error if a bibliografy in included (Error: Could not start the command: sh -c "mkdir ...). Any idea why this happens?

  • 2
    Running pdflatex with the -shell-escape option, with \immediate\write18{mkdir -p ./temp} as the first line of the document (if you're on a Unix system). But it seems much more complicated than just creating the folder when the document is first set up.
    – egreg
    Oct 18 '15 at 10:48
  • thanks, that's a good alternative, but I was trying to do everything from within Texstudio, if possible. Oct 18 '15 at 11:52
  • My advice is doing a feature request to the developers.
    – egreg
    Oct 18 '15 at 12:22
  • You could alter the command executed by TS couldn't you?
    – cfr
    Oct 19 '15 at 23:57

You can modify the command for pdflatex yourself to create a directory if necessary. This would be something similar to

sh -c "mkdir -p temp & /usr/texbin/pdflatex -synctex=1 -interaction=nonstopmode -output-directory=temp %.tex"

Details may vary depending on the operating system and on the TeX distribution.

See also the corresponding feature request.

  • /usr/texbin is no longer correct for current Macs because /usr is no longer writeable.
    – cfr
    Oct 20 '15 at 0:00
  • @Tim Hoffman, thanks, it does exactly what I needed! (using Windows 7). For future reference, I create both the auxiliary files directory temp and the output directory output with sh -c "mkdir -p temp output & pdflatex.exe -synctex=1 -interaction=nonstopmode -output-directory=output -aux-directory=temp %.tex Oct 20 '15 at 9:33
  • P.S.: the above command should be put in the PdfLaTex box in Options > Configure Teststudio > Commands. As usual, the directory relative path should be specified in Configure Teststudio > Build (clicking on advanced options box). In my case, ./temp and ./output under Log file and Pdf file, respectively. Oct 20 '15 at 10:58
  • @Tim Hoffman I updated the initial question to make it more general. Can you suggest a way to make your solution work in case a bibliography is added to the document? Oct 27 '15 at 11:34

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.