# Why is it necessary to compile 4 times when using bibliography?

I am writing a paper with TexMaker and I and handling the bibliography apart in a bibliography.bib as I think it is more efficient and clean.

To include it I need to set the command

``````\bibliography{bibliography}
``````

and every time I want a citation I write

``````\cite{label}
``````

Allright. It took me a while to be able to see the citations and references, until I discovered that I had to write next compilation sequence:

``````1- PDFLatex

2- BibTex

3- PDFLatex

4- PDFLatex
``````

Why is it necessary to compile 4 times to be able to see changes in bibliography?

-
User tohecz summed it up nicely in his reply. – dhst Jul 5 '12 at 7:40
Thanks! So I asked kind of duplicate? – Jav_Rock Jul 5 '12 at 7:42
No harm done, I guess. Take a look at doncherry's remark concerning latexmk, though. It takes care of all the work for you and is actually already implemented in Texmaker. – dhst Jul 5 '12 at 7:47
possible duplicate of Why does Latex/Bibtex need three passes to clear up all warnings? – egreg Jul 5 '12 at 19:40

Well lets assume that you have a number style, so `\cite{knuth}` should at the end give "see [3]" in the text and "[3] Knuth, The TeXbook" in the bibliography.

The information is gathered in this way:

1. In the first pdflatex run, latex writes `\citation{knuth}` to the `aux`-file, and an information about the `bib`-files and the style you want to use.
2. The bibtex run uses the informations of the `aux` file to generate from the bib-files a `bbl`-file which contains the bibliography with all the sources you want to cite (sorted and formated).
3. In the second `pdflatex` run, latex prints the bibliography from the `bbl` file and while doing this extract the numbers associated to a key and stores it again in the aux-file: `\bibcite{knuth}{3}`.
4. In the next run `pdflatex` uses this informations to update the number in you text "see [3]".
5. As this can change the formatting of your text you perhaps need more runs to update page references.

If you use `biblatex` with `biber` things are bit different, as `biber` doesn't use the aux-file but needs its informations in a bcf-file but the principe is similar

-