Fixing LaTeX Cross-References: The Multi-Pass Compilation Sequence
Unresolved LaTeX references show '??' until you complete the full pdflatex and bibtex multi-pass compilation sequence.
09 Jul 2025, 10:16 UTC

Why Your LaTeX References Show Question Marks
If your compiled PDF contains ?? instead of equation, figure, or section numbers, the document's cross-references are unresolved. This usually happens after you add a new \label, move content, or process a bibliography. LaTeX cannot resolve these references in a single pass because it collects label information during one run and applies it during the next.
The Required Compilation Sequence
For a document using bibtex, run the following from the directory containing your main .tex file. You need standard user write permissions for that directory because the engine writes auxiliary files such as .aux, .bbl, and .blg.
pdflatex main.tex bibtex main pdflatex main.tex pdflatex main.tex
Replace main with your document's base filename. The first pdflatex pass writes label data to the auxiliary file. bibtex processes citation keys. The next two pdflatex passes propagate citation and reference data into the final PDF. Skipping any pass can leave ?? in the output.
Worked Example: Equation Reference
Create a file named example.tex:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
E = mc^2
\label{eq:energy}
\end{equation}
As shown in Equation \ref{eq:energy} on page \pageref{eq:energy}.
\end{document}Run the sequence above. After the final pass, open example.pdf and confirm the text reads "Equation 1 on page 1" rather than "Equation ?? on page ??". If you change the equation order or add a bibliography, repeat the sequence because label locations and citation numbers can shift.
Trade-off: Compilation Time vs. Reference Accuracy
The limitation is time. Each additional pass re-reads the document and rewrites auxiliary files, which matters for large books or documents with many graphics. The practical check is to inspect the PDF after the full sequence: every \ref and \pageref should show a number. If any still show ??, run the sequence once more; persistent failures usually indicate a missing \label, a typo in the reference key, or a label placed after the element it references.
Actionable Closing
Make the four-command sequence your default build routine for any document with cross-references or citations. Do not assume one pdflatex run is enough, and do not delete auxiliary files between passes unless you are intentionally starting a clean build.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.