As explained by Andy Roberts, if you need to compile a new document with bibtex citations, then you need to run latex three times, and bibtex once:

latex document
bibtex document
latex document
latex document

Why can't latex figure this out itself, and just do what it needs to do? What is it doing in the later runs that it can't do in the earlier runs?

  • 9
    I recommend latexmk (Homepage/CTAN), which does what you're demanding: It figures out what needs to be run how often all by itself. It works well with BibTeX and Biber, but might need some fine-tuning for other things, e.g. glossaries, about which you'll find questions on here. The author is also very responsive and actually answers questions here on tex.sx.
    – doncherry
    Apr 25, 2012 at 9:46
  • @doncherry: I actually use pdflatex, does latexmk output to pdf?
    – naught101
    Apr 25, 2012 at 10:26
  • 2
    Yes, use it like this: latexmk -pdf foo.tex. There are many more options available, e.g. latexmk can automatically compile whenever you save the .tex file (that's the -pvc [preview continuously] option). Check out its manual, it's fairly comprehensible.
    – doncherry
    Apr 25, 2012 at 10:46

1 Answer 1


The reason is as follows:

  1. At the first latex run, all \cite{...} arguments are written in the file document.aux.

  2. At the bibtex run, this information is taken by bibtex and the relevant entries are put into the .bbl file, sorted either alphabetically or by citation order (sometimes called "unsorted") and formatted according to the instructions provided by the bibliography style that's in use.

  3. At the next run of latex, the .bbl file is included at the point the \bibliography instructions, and the correct labels for \cite{...} commands are written in .aux file.

  4. Only at the last run, latex knows what the correct labels are and includes them in the document.

The reason why TeX and BibTeX have been made this way is that back then, the memories used to be small, and file systems were the only good ways to store files. But you cannot read and write the same file (well, you can, but it's more complicated), that's why you have to run latex twice after bibtex, as well as you have to run it twice where you cross-reference etc.

Some passes can be saved using biblatex instead of bibtex. Anyways, all references (and cross-references) stabilize during the document preparation since all of us compile our documents many times...

  • 9
    biblatex doesn't avoid the need of multiple pass processing.
    – egreg
    Apr 25, 2012 at 8:58
  • 1
    I have always thought that it reduces at least one pass...
    – yo'
    Apr 25, 2012 at 9:02
  • 2
    Yes, it may avoid one pass. But it's not so important to always do all passes: it's quite often only a waste of time. Cross references will stabilize during document preparation and it's not necessary that they are always correct. Just remember to run BibTeX (or Biber) when citations are added.
    – egreg
    Apr 25, 2012 at 9:15
  • 2
    Ah, so the reason is historical (memory). You'd wonder why 'they' haven't updated latex to /not/ cater for memory limited systems anymore (at least not by default)... Aug 30, 2012 at 7:09
  • 1
    I've taken the liberty of providing a bit more information about the output of the bibtex run. Hope you agree.
    – Mico
    Oct 29, 2014 at 20:22

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.