Undefined references & duplicate labels

When you see ?? where a number should be (or [?] for a citation), a cross-reference is unresolved. It is almost always one of: too few compile passes, a missing or misspelled \label, or a \label in the wrong place. Duplicate labels raise a separate warning.

What ?? means

\ref / \pageref read the .aux written by the previous run, so on the first pass (or right after adding a label) the value is unknown and prints ??, with the log saying “Rerun to get cross-references right.” \cite shows [?] the same way. The fix is to compile again — twice in total (latexmk and other build tools do this automatically). If ?? survives two passes, the label is genuinely missing.

Label not found

  • There is no \label{x} matching \ref{x}, or it is misspelled.
  • In floats, put \label right after \caption (inside the float) — before or outside, it grabs the wrong number (e.g. the section).
  • A citation stuck at [?] → run bibtex/biber and recompile, or the key is missing from the .bib.
  • Use consistent label prefixes (fig:, sec:, eq:) to keep them organized and searchable.
latex
\begin{figure}
  \includegraphics{fig.pdf}
  \caption{グラフ}
  \label{fig:graph}   % \caption の直後に / right after \caption
\end{figure}
... 図~\ref{fig:graph} を参照。

Duplicate labels

LaTeX Warning: Label 'x' multiply defined means the same \label{x} appears twice, making references ambiguous. Make labels unique (with prefixes or distinct names). The usual cause is a label duplicated by copy-paste.