putting (aux log out toc bbl bib blg) files in another directory with latexmk
auxdir
is the directory for all auxiliary files but not the PDF file.
latexmk -auxdir=/tmp test.tex
should work. You can extend this to autocompile with latexmk -auxdir=/tmp -pdf -pvc test.tex
The manual man latexmk
/ texdoc latexmk
explains more about the auxdir
parameter:
-auxdir=FOO or -aux-directory=FOO Sets the directory for auxiliary output files of (pdf)latex (.aux, .log etc). This achieves its effect by the -aux-direc‐ tory option of (pdf)latex, which currently is only implemented on the MiKTeX version of (pdf)latex. See also the -outdir/-output-directory options, and the $aux_dir, $out_dir, and $search_path_separator configuration variables of latexmk. In particular, see the documentation of $out_dir for some complications on what directory names are suitable.
The auxdir parameter was introduced in version 4.39.
I suppose that latexmk
also can handle the option output-directory=...