TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to put (aux log out toc bbl bib blg) files in another directory with latexmk?

share|improve this question
related question: tex.stackexchange.com/questions/30350/… – doncherry Nov 19 '12 at 6:42
Jonas' solution, which is based on a more current version of latexmk, seems superior to me; I suggest changing the accepted answer. – doncherry Nov 19 '12 at 6:47
@doncherry: Done, but it doesn't yet work with my MacTex installation unfortunately. – Neil G Nov 19 '12 at 14:51
up vote 3 down vote accepted

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
share|improve this answer
Which versions of latexmk have this feature? I'm on 4.24, and it doesn't seem to exist... – dinosaur Mar 30 at 1:15

I suppose that latexmk also can handle the option output-directory=...

share|improve this answer
can I keep the pdf file in the same directory, or is that too hard? – Neil G Dec 25 '10 at 7:00
I got output-directory working by changing the way latexmk calls pdflatex – Neil G Dec 25 '10 at 7:34
no, all output is affected. I always put a link from my doc directory to the pdf in the outpunt directory. – Herbert Dec 25 '10 at 7:51
good idea. – Neil G Dec 25 '10 at 18:10
I think that you might have to use -jobname with recent versions of latexmk. (My version does not seem to support the output-directory option.) – mforbes Oct 6 '11 at 18:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.