[Tex/LaTex] A question mark instead of reference number appears when \cite is in a separate file inlcuded in the main file by \include

bibtexinclude

I am using the book style and each chapter is put in a separate file and included in the main file by \include. At the end of the main file, I put the following lines:

\bibliographystyle{plain}
\bibliography{D:/paper/Bibtex/refguo}

But when I cite a reference in Chapter 1, for instance, which is in a separate file, a question mark [?] appears instead of the right reference number. But at the end of the PDF file produced, the references are correctly listed.

I don't know how to fix this.

Best Answer

Probably you just need another LaTeX run.

  1. LaTeX writes a citation into the .aux files. In case of included files via \include it is the .aux file for the included file. If a citation \cite{xyz} is added, then you should see \citation{xyz} in the right .aux file after the next LaTeX run.

  2. Then bibtex should be run. It collects all \citation statements from the .aux files and writes the bibliography.

  3. In the next LaTeX run after bibtex the bibliography is present with the new reference. But LaTeX does not know yet, which references the bibliography will contain. It records this in the .aux file with \bibcite{xyz}{1} (the second argument is the citation form). Thus you get still [?] for the new citation.

  4. Another LaTeX run is needed, at the beginning it reads the .aux files with \bibcite and knows, how to cite xyz and you get [1] for \cite{xyz}, for example.

In summary, the following runs are needed after a citation is added:

  • 1 × LaTeX
  • 1 × BiBTeX
  • 2 × LaTeX