TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 often use the out-of-source compilation on my LaTeX code to separate the generated files from the source files, thus I can conveniently commit my code to the repository. The command is like this:

pdflatex -c-style-errors -include-directory=dir_of_source_files -output-directory=dir_of_generated_files -aux-directory=dir_of_aux_files main_tex_file.tex

As the options indicated, the generated files are well managed by the compiler. Recently, I turn to bibtex to manage my bibliography instead of typing the bibitems directly in a tex file. And I would like to use the workflow as above - to put the generated file into another directory. As a result, I failed. This is the test snippet:

The device \cite{Vikas01} is special \cite{Bernard03}.

The content of the bib file is:

  AUTHOR={Bernard Desgraupes},
  TITLE={{\LaTeX}, {A}pprentissage, guide et r{\'e}f{\'e}rence},

  AUTHOR={Kawadia, Vikas},
  TITLE={Protocols for Media Access Control and Power Control in Wireless Networks},
  BOOKTITLE={40th IEEE Conference on Decision and Control},

And my compilation commands are:

pdflatex -c-style-errors -include-directory=dir_of_source_files -output-directory=dir_of_generated_files -aux-directory=dir_of_aux_files main_tex_file.tex
bibtex -include-directory=dir_of_aux_files main_tex_file

Then the prompt comes out:

I couldn't open file name 'refs.aux'

And there is also a suspicious warning in the log file:

LaTeX Warning: Citation `Vikas01' on page 1 undefined on input line 5.

LaTeX Warning: Citation `Bernard03' on page 1 undefined on input line 5.

No file testbib.bbl.
] (d:\tex\bin\testbib-shadow\au\testbib.aux)

LaTeX Warning: There were undefined references.

I guess that the compiler failed to generate the .bbl file. How to fix this problem?

share|improve this question
Welcome to TeX.sx! I ran your example and it worked without errors or warnings. I used pdfTeXify in WindEdt+MiKTeX. Did you run the required number of times? The warnings you get are typical from the first run where the files required for proper formatting are generated. – Peter Jansson Jan 25 '13 at 10:35
@PeterJansson Thanks for your help! Then you're testing the snippet in an IDE while my target is to do it in the windows command line and compile it out-of-source, or you can call it shadow build. – stoneyang Jan 25 '13 at 10:47
up vote 5 down vote accepted

bibtex does not have a -include-directory switch, so it has to see the .aux file of your document in the directory where it is invoked.


bibtex dir_of_aux_files/main_tex_file

should be used, where main_tex_file is of course without the .tex at the end.

share|improve this answer
Thanks for your hints! @mafp – stoneyang Jan 25 '13 at 11:15
It is just a slightly modification to enable that. But what I want to add is that bibtex does have a -include-directory switch although it doesn't work well on my machine with Windows 7 Ultimate 64-bit and MikTex-BibTeX 2.8.3581 (0.99c). :) – stoneyang Jan 25 '13 at 11:22
@stoneyang Interesting. I too have version 0.99c, and I swear it has no -include-directory switch. But I use Linux, so maybe the MiKTeX people patched bibtex. – mafp Jan 25 '13 at 11: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.