There are several issues related to the latex-workshop.latex.outputDir setting - #117, #248 and #341.
However, in each case, the solution is "outputDir doesn't do what you expect," and the issue is closed.
This is fair enough and I appreciate that the outputDir setting is used for another intended purpose.
Apologies for the newbie question, but please could a kind reader guide me on how to configure LaTeX Workshop (or one of the other tools) such that the output from "Build LaTeX Project" goes to a directory of my choice (in my case ./out/)? I am sure it's a simple tweak I need to make to some config file somewhere...
Many thanks for your time.
After some further playing about, I realised that's what latex-workshop.latex.recipes and latex-workshop.latex.tools are for...
I currently have the following setup for the default (latextmk), which outputs all the files, including the PDF file, to ./out/:
"latex-workshop.latex.outputDir": "./out/",
"latex-workshop.latex.recipes": [
{
"name": "latexmk",
"tools": [
"latexmk"
]
}
],
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-aux-directory=out",
"-output-directory=out",
"%DOC%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-aux-directory=out",
"-output-directory=out",
"%DOC%"
]
}
]
The keys seem to be the -aux-directory and -output-directory options, although I'm currently unsure which are definitely required and which are currently superfluous...
I'd be interested in some hints or suggestions from someone who knows that they're talking about.
Many thanks.
I'm not familiar with either argument, but it seems like -aux-directory is where the auxiliary files will be placed, e.g., .bbl, .aux, .fls files. -output-directory is where the document will be placed, e.g., .pdf, .dvi.
-aux-directory make no sense on Mac, and the aux file can still not be found by the pdflatex.
Here is my config file to solve this problem for reference.
```
"latex-workshop.latex.outDir": "out.nosync",
.........
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-output-directory=out.nosync",
"-aux-directory=out.nosync",
// "-jobname=main.pdf.nosync",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"out.nosync/%DOCFILE%"
]
}
Just use the latexmk recipe and set "latex-workshop.latex.outDir": "out.nosync".
Replace out.nosync with %OUTDIR% for a better understanding.
Most helpful comment
After some further playing about, I realised that's what
latex-workshop.latex.recipesandlatex-workshop.latex.toolsare for...I currently have the following setup for the default (
latextmk), which outputs all the files, including the PDF file, to ./out/:The keys seem to be the
-aux-directoryand-output-directoryoptions, although I'm currently unsure which are definitely required and which are currently superfluous...I'd be interested in some hints or suggestions from someone who knows that they're talking about.
Many thanks.