When I compile my document I get warnings of the form:

Package natbib Warning: Citation `xxxxx' on page y undefined on input line 

This problem does fix itself eventually when the compiler reached my bibliography.bib file but is there a way I can prevent them from occurring in the first place?

6 Answers 6


Getting citations and references right always requires multiple runs of latex. The normal procedure is the following

latex <file>
bibtex <file>
latex <file>
latex <file>

The first compile finds all the cite commands and makes a list of them in the .aux file, and takes note of the bibliography style. No citations are resolved in your document yet.

Then bibtex processes the aux file and using the bibliography style, and the list of citations creates a .bbl file which contains the bibliography. No citations are resolved yet here either.

The next latex compile doesn't resolve the references either, but reads the .bbl file and keeps track of the citations.

Finally the last latex compile resolves all the references.

The warnings you receive are normal, and should really only be paid attention to after the last latex compilation in the steps above.

There are various scripts that automate some of these procedures so that you don't forget to do the multiple latex runs; one is latexmk and another is rubber.

Many text editors have access to these in some simple way, so before thinking about installing them you should find out if your editor already has a way to use them.

  • 6
    That is not always sufficient. It's possible for a reference to move around after every compile. In the worst case, the reference will always be wrong, no matter how many times you compile it.
    – TH.
    Jan 5, 2011 at 20:53
  • Doesn't work. Still got the same errors.
    – user19502
    Jun 30, 2013 at 23:44
  • @user19502 Are you getting exactly the same warning as in the question? Are you sure you don't have a typo in the citation key?
    – Alan Munn
    Jun 30, 2013 at 23:48
  • I might have had some errors, I don't have them now. For the past five hours I've been trying to make the bibliography in my own thesis look the way I want, not the way Latex wants
    – user19502
    Jul 1, 2013 at 0:36
  • 1
    @Tjebo The -f option forces latexmk to continue processing even after errors have been encountered. This is usually not really necessary, since it will do additional compilations that will not really do much if an error has been encountered earlier.
    – Alan Munn
    Jan 3, 2021 at 19:31

I had this message pop up in my console output for all my citations, also after several compilations, although the bibliography and citations actually displayed correctly in the TeXworks pdf preview.

In my case, I had a few references in my .bib file where words with diacritics weren't surrounded in curly braces. Changing all such instances got rid of the messages. For example:

publisher = {Universidad Nacional de Río Negro},

Changed to:

publisher = {Universidad Nacional de {Río} Negro},

  • I had a similar issue with overleaf. In my case I had to change author = { Davis, S., Nesbitt, K. and Nalivaiko, E. }, to author = {Davis, S and Nesbitt, K and Nalivaiko, E},.
    – rluks
    Sep 13, 2017 at 8:37

Not sure if it relates directly to your problem but I kept on getting bibtex key is undefined errors in Texlipse even though the bibliography compiled fine.

I manage my bibliography using Jabref. What happens is that sometimes I would accidentally create a new empty entry in Jabref (e.g. click on add new entry, make no changes, and hit enter = empty entry). This is what generated the error in Texlipse. Delete these empty entries and everything will be fine.


I've run into this problem because I had an syntax error in my .bib file. Make sure to check if no commas are missing or, like arjan pointed out, all words with special chars are enclosed by curly braces. Hope this helps someone.


I met this problem. After checking the code, I found that I accidentally deleted the code \bibliographystyle{ACM-Reference-Format} \bibliography{bibfile}. Make sure you have defined the bibliography style and bibliography file first. :)


Answer 2022: Maybe the .tex name file.tex contains blank spaces, I removed them with underscore like this: name_file.tex and it worked.

You must log in to answer this question.