Tuesday, October 26, 2010

LaTeX: MiKTeX undefined references

For the past three days I tried to get started with LaTeX on Windows. Using MiKTeX, I ended up in a situation where (a) my bibliography wasn't showing at all, (b) citations showed up as [?], and (c) the log complained about undefined references.

It turned out that the errors were obscure and unrelated to the cause. The references and citations were fine; it was the bibliography style that was incorrect. It needs to be like this to work:

\bibliographystyle{plain}
\bibliography{mybib}
\nocite{*}

You need to use \bibliographystyle and not \bibstyle that appears on some websites. The style needs to exist or it will not work. The bibliography file specified must be without the .bib extension. \nocite{*} is optional and makes LaTeX include references even if they are not cited.

Also, you may need to compile two or three times for the references to be properly linked.

No comments:

Post a Comment