The implementation fo pdfTeX provided by TeX Live (and, hence, MikTeX) does not support outputting the PDF to one directory and other generated files to another.
It is possible to output all generated files to a directory other than the working one. For example, suppose that filename.tex
is in the working directory, then we can create a subdirectory, out
for the generated files.
mkdir out
Then
pdflatex --output-directory=out filename.tex
will output all generated files to out/
.
$ ls
filename.tex out/
$ ls out
filename.aux filename.log filename.pdf
What you could do in the case of TeXShop is to modify the engine so that the PDF is automatically moved back to the working directory.
mv -f out/filename.pdf ./
will move the generated file back to the working directory. (Obviously, you'd want to use the relevant TeXShop variable instead of filename
but I don't have TeXShop available so I'm not sure if it would be the same as my editor's.
Note that this will overwrite any existing filename.pdf
in the working directory, so should be used with caution. Until you are confident of the script, it would be safer to use
[[ -e "filename.pdf" ]] && mv filename.pdf out/filename.pdf.$$
mv -n out/filename.pdf ./
and remove the defunct PDFs from the output directory manually.
However, although all of this is possible, I strongly recommend not doing it at all. Things are much, much simpler when everything is where it is expected to be by default.
Not only pdfTeX, but also all the other programmes involved in creating a document must be able to find the generated files, including scripts such as makeglossaries
and binaries such as Biber. makeindex
, epstopdf
, image externalisation, some forms of verbatim listings and much. much more all write and read files which are expected, by default, in the working directory.
The directory may look tidier when listed, but the price is high in terms of additional complexity. TeX errors are hard enough to track down without adding avoidable complications!
Caveat emptor ...
--output-directory
. However, I strongly recommend not trying to do this, especially if you are relatively new to TeX.pdftex
will, I think, put the PDF with the rest of the files - you can't separate intermediate files from output - and this means you have the problem of your editor finding the PDF. But the more serious issues tend to come from the coding. Will everything know where to look? Not justpdftex
, butbibtex
orbiblatex
? What aboutmakeindex
ormakeglossaries
? If you externalise graphics, where do they go? What if you include an image which needs conversion? Then the original is in one directory, maybe the converted is in another.