1

I'm using latexmk Version 4.41. Calling latexmk -pdf document_template.tex compiles fine without any errors. However when I attempt to output all the aux files into a folder tmp with the following command:

latexmk -auxdir=./tmp/ -pdf document_template.tex

I get the following error:

Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  pdflatex: (Pdf)LaTeX failed to generate the expected log file 'tmp/document_template.log'
Latexmk: Did not finish processing file 'document_template.tex':
   (Pdf)LaTeX failed to generate the expected log file 'tmp/document_template.log'
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.

And only the .aux and the .fdb_latexmk file will be in the .\tmp folder, whereas the rest of the aux files are in the same folder as the .tex document. What am I doing wrong?

  • Do yourself a favour and don't use another directory for the aux files - this causes way more problems then it solves. However if you really insist on doing it, use a tool like ltx2any which deals with most of the resulting problems. – user36296 Mar 31 '18 at 14:02
  • @samcarter Can you please elaborate on what kind of problems this would cause? – spurra Mar 31 '18 at 14:21
  • This will cause problems when using a bibliography, index and many other things. – user36296 Mar 31 '18 at 14:27
  • see for example tex.stackexchange.com/a/313228/36296 for a demonstration of possible problems – user36296 Mar 31 '18 at 17:07
  • @spurra What TeX system are you using? With TeXLive, the -auxdir option is not supported, since the underlying TeX engines don't support it. If you try using it, pdflatex will itself give an error message, and latexmk will give the message you showed. Only the -outdir option is supported when you use TeXLive. – John Collins Mar 31 '18 at 20:18
1

I've got exactly the same problem. After exploring a bit I've found the following.

Diagnostic

First, I'm working on MacOSX using MacTex as the Latex compiler. The latexmk documentation says the following:

-auxdir=FOO Sets the directory for auxiliary output files of (pdf)latex (.aux, .log etc). This achieves its effect by the -aux-directory option of (pdf)latex, which currently is only implemented on the MiKTeX version of (pdf)latex. (Taken from: https://man.cx/latexmk)

I'm not using MikTex so I´ve suspected this was part of the problem. (more info here: Latex distributions. What are their main differences?)

Solution

Add the option outdir and point it to the same directory as auxdir. In your case would be:

latexmk -auxdir=./tmp/ -outdir=./tmp/ -pdf document_template.tex

This will put all the derivative files into tmp

Check if you need auxiliary folders

If you use the \include{} command inside your latex document you may need to create a directory inside the tmpdirectory. More info here: (latexmk -outdir with \include)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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