6

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).

EDIT:

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. – Stefano Lombardi 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

1 Answers1

4

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.

Tim Hoffmann
  • 11,159
  • /usr/texbin is no longer correct for current Macs because /usr is no longer writeable. – cfr Oct 20 '15 at 00: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 – Stefano Lombardi Oct 20 '15 at 09: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. – Stefano Lombardi 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? – Stefano Lombardi Oct 27 '15 at 11:34