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

I'm trying to use latexmk for the first time in Ubuntu. My project directory is the following:

  • Project
    • src
    • build
    • images

In the src directory are the .tex and .bib files. I want the .aux, .bbl, .log etc. files to go into the build directory.

In the root directory I have the following script:


if [ $# -gt 0 ];then
    if [ $1 = "-c" ];then
        cd build
        latexmk -c ../src/poly-paper.tex
    cd build
    latexmk -pdf ../src/poly-paper.tex
    mv poly-paper.pdf ..

The problem is that using this script causes it to not find the bibliography. My latexmk is v4.24 and doesn't support the -auxdir commands and I have to do without it so that someone else can compile it too.

Could someone suggest a solution please?

EDIT: I didn't know latexmk is a simple script, so I installed the newest version but I have problems using the -auxdir and -outdir commands. The problems is that Ubuntu comes with TexLive 2009 which does not support the -output-directory for pdflatex.

share|improve this question
Welcome to TeX.sx! The current version of latexmk is 4.35. Maybe an update will help. – Marco Daniel Mar 3 '13 at 10:56
Thank you. Unfortunately, some other people besides me will want to build the project and I can't force all of them to update. – Grieverheart Mar 3 '13 at 10:59
latexmk is a single selfcontained script, so you could even include a copy of it in your project. – daleif Mar 3 '13 at 18:14
up vote 4 down vote accepted

If the underlying latex command doesn't support the -output-directory option, then latexmk's -outdir option won't work.

A simple solution with the scripts you are using would be to set the BIBINPUTS environment variable to include the source directory, e.g.,

export BIBINPUTS=:../src
share|improve this answer

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.