While working on a document, it would be helpful if instead of a ? for unresolved references or citations the tag used in the \ref{thisthings} or \cite{Bloke1978} could appear instead.

Is there a package that turns on this behaviour?


Rather than redefining \cite or connected commands, one might consider using the showkeys package, that will print every key and mark every usage of \label so that, during document preparation, cross-references can be checked quite easily.

This has a drawback: line and page break can be different when using or not using the package. However, line and page break are not much of a concern when we are writing our manuscript. When finalizing the project just comment out the call to showkeys: the cross-references should be OK, at that point.

  • That is a more useful solution than just replacing the unresolved labels. Thanks! – Alex Feb 18 '12 at 22:46
  • Hmmm, this is nice, but is almost useless for citation-heavy documents like reviews, because there is too much extra text. – Vincent Fourmond Mar 14 '17 at 21:44

Even if there is no such package, it's easy to modify the corresponding commands with the help of the etoolbox package. This may, however, fail if some package redefines the commands in an incompatible way.



\patchcmd{\@setref}{\bfseries ??}{[\texttt{#3}]}{}{%
  \GenericWarning{}{Failed to patch \protect\@setref}}
\patchcmd{\@citex}{\bfseries ?}{\texttt{\@citeb}}{}{%
  \GenericWarning{}{Failed to patch \protect\@citex}}



  • 4
    One might also consider the showkeys package. – egreg Feb 18 '12 at 11:16
  • @egreg: That's cool! Your comment should be an answer. – Andrey Vihrov Feb 18 '12 at 11:18
  • 1
    Adding to this MWE the package \usepackage{natbib} it does not work anymore. How has the \patchcmd for citex be modified? – Hotschke Jul 27 '15 at 9:50

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.