References before appendix

My (BiBTeX) references need to appear before my appendix, but my appendix contains new references. These references are flagged as undefined unless my bibliography appears AFTER the appendix. Is there a way to fix this?

-
Please proivde a minimal example which shows such a behavior. Normally the output is independent from the order. –  Marco Daniel Oct 30 '11 at 7:40

2 Answers

This kind of behaviour is usually fixed by compiling your document more than once.

Every time you compile your document latex reads and writes information to a few different files: \jobname.aux, \jobname.toc, etc. When you use biblatex you run bibtex, or biber, etc to update the bibliography auxiliary files. Once these files are updated, you re-compile the original document which will be able to read the updated reference & citation information.

-

Here is also an MWE based on the answer of @cmhughes, which uses biblatex and biber - let's call it test.tex:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[style=ieee]{biblatex}
\bibliography{biblatex-examples}

\begin{document}
\frontmatter
\mainmatter
\chapter{First chapter}
bla bla \cite{westfahl:space} bla bla \cite{aksin} ...
\printbibliography
\appendix
\chapter{Second chapter}
bla bla ... \cite{angenendt} bla bla \cite{baez/article}
\backmatter
\end{document}


It can be compiled with:

pdflatex test.tex
biber test
pdflatex test.tex
#pdflatex test.tex # not sure if this additional one is needed here


In any case, you'll see that all of the references used are reported in the one and only bibliography (inserted at \printbibliography), regardless of where the \cites are first used (before or after that command).

Here is an image composed of the output pages:

-