TransWikia.com

Defining -aux-directory for pdflatex breaks citations for natbib

TeX - LaTeX Asked by roboreb on January 28, 2021

When I run pdflatex with an -aux-directory flag it makes it so natbib can’t find the citations.

pdflatex command with -aux-directory:

pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex -aux-directory=auxillary

and without:

pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex

When I run it with -aux-directory, no bbl file is generated, the references page is missing, and the log shows a long sequence of errors like the following:

Package natbib Warning: Citation `Altman2006' on page 1 undefined on input line

When I run it without -aux-directory, then everything is fine.

Has anyone else experienced this problem?


MWE:

PhD_Thesis.tex

documentclass[11pt,twoside,a4paper]{article}

usepackage[round,authoryear]{natbib}
begin{document}

Bibtex test: citet{Card1999} 

bibliographystyle{apalike}  
bibliography{PhD_Bibliography}
end{document}

PhD_Bibliography.bib

@INCOLLECTION{Card1999,
    author = {David Card},
    title = {The Causal Effects of Education on Earnings},
    booktitle = {Handbook of Labour Economics},
    year = {1999},
    editor = {O. Ashenfelter and David Card},
    volume = {3},
    pages = {1801-1863},
    publisher = {Elsevier Science B.V},
    chapter = {30}
}

One Answer

If your thesis is a single file (which is somehow unlikely) it is enough to append your bibtex command with ./auxillary/%.

Else, I've written a bash script shared in this answer but it's for linux environments. However you can copy the working in a bat file for windows:

  • first, the script needs to go into the aux folder
  • run bibtex on the main aux
  • copy the generated bbl file to all chapter filenames (eg main.bbl, chapter1.bbl, etc)

That's it, call the script instead of bibtex. Also, (that probably isn't a problem with -aux-directory, but one with -output-directory) if each chapter is in its own dedicated folder, you need to copy the folder structure into the build folder (here 'auxilliary').

Answered by luneart on January 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP