I have seen answers to this similar question which suggest using latexmk -c
or pdflatex -aux-directory=/some/temp/dir <additional options>
. I prefer the latter because you can create a subdirectory without having to remove and generate files repeatidly. Currenlty, this option is "only implemented on the MiKTeX version of (pdf)latex". On the other hand, the former approach does not seem to work properly. I use LaTeX Workshop in Visual Studio Code which by default uses latexmk
. To add the -c
flag, I created the following receipe:
"latex-workshop.latex.tools": [
{
"name": "latexmk -c",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-c",
"%DOC%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "latexmk -c",
"tools": [
"latexmk -c"
]
}
]
If I first create the pdf file from latex source files and then add the -c
flag for the next compiles, it removes the additional files properly. However, if you want to compile for the first time (when there is no pdf or auxiliary files available), it does not generate any pdf file and I should consider removing the -c
flag. Even if you already have the pdf file and its associated files available, once you remove only the pdf file from the folder, the same problem occurs. Is there an efficient way to hide such auxiliary files (by removing them or preferably puting them in a subfolder) in Linux (or in vscode)?
.pdf
file to%DIR%/aux
? OP does not want that, if I understand correctly. – Polarimeter