12

How do I find unresolved references? Does LaTeX tell me this somewhere? Is it in a log file? The LaTeX output just says I have unresolved references, but it doesn't tell me what they are, or does it? thanks

12

Yes. If you compile the following document that contains an unlabelled reference:

\documentclass{article}
\begin{document}
\ref{abc}
\end{document}

your .log will contain (amongst other things):

LaTeX Warning: Reference `abc' on page 1 undefined on input line 3.

It will also end (almost as a summary) with:

LaTeX Warning: There were undefined references.

notifying you that something is amiss. You also know where these are by searching for ?? in your document - the default definition given to undefined (or unresolved) references - as can be seen by the definition of \ref (from latex.ltx):

\def\@setref#1#2#3{%
  \ifx#1\relax
   \protect\G@refundefinedtrue
   \nfss@text{\reset@font\bfseries ??}%
   \@latex@warning{Reference `#3' on page \thepage \space
             undefined}%
  \else
   \expandafter#2#1\null
  \fi}
\def\ref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
\def\pageref#1{\expandafter\@setref\csname r@#1\endcsname
                                   \@secondoftwo{#1}}

Of course, you need to compile at least twice to make there actually is undefined references.

  • 1
    note that you need to search for ?? in the output of your document -- the log tells you what page(s) to look on. searching in the input would be fruitless (and frustrating). – barbara beeton Oct 8 '13 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.