[Tex/LaTex] bibtex does not find bibliography fields when using latexmk and outdir

bibliographieslatexmk

I compile a document with this command:

    latexmk -outdir=obj these.tex

In these.tex, I specify \bibliography{../Bibliography}. But, when latexmk calls bibtex, the .aux file is one folder deeper and, hence, the compiler doesn't find the file.

Indeed, if in my .tex file I use \bibliography{../../Bibliography} then everything works fine for bibtex, but latexmk fails to find the file. Using -auxdir=obj doesn't change anything.

What can I do ?

edit: it seems important to precise that latexmk is called via a makefile.

Best Answer

In your project root, create a .latexmk file with the following contents:

$bibtex = "bibtex -include-directory=.. %O %B";

This tells bibtex, which is executed in the obj directory, to look for *.bib files in ../obj.