Let
X
Error

LaTeX: Undefined references and ?? in output

The fix

Seeing "??" instead of a number, or "Reference/Citation undefined" warnings, means the labels have not been resolved yet. Fix it by compiling again — LaTeX needs at least two passes so the .aux file is written and then read. Citations also require a BibTeX/biber run between passes.

Why it happens

Cross-references (\ref, \cite) are resolved from auxiliary files generated on a previous run. On the first compile those files do not exist yet, so references show as ??.

Example

% Build order for citations:
%   pdflatex main      (writes .aux)
%   bibtex main        (reads .aux, writes .bbl)
%   pdflatex main      (pulls in references)
%   pdflatex main      (resolves all numbers)

% On LetX this full sequence runs automatically on Compile.

Frequently asked questions

Why two compiles?

LaTeX writes label and page data to a .aux file on the first pass, then reads it on the second to fill in numbers. One pass cannot know a number it has not computed yet.

My \cite shows [?]

Run BibTeX/biber after the first pdflatex pass, then compile twice more. On LetX this happens automatically when you click Compile.

Try the fix in LetX

Open the editor, paste your code, and compile in 1–2 seconds to see the error clear — free, in your browser.

Open LetX Free