1

I would like to replace the ?? displayed when autoref cannot find a reference with a custom text, for example full paper (that way when the theorem is not present it just points to the full paper) or \color{red} undefined Label to make it extra visible.

Somebody gave an answer here for cleveref, but I'd a solution involving only autoref.

Thanks!

MWE:

\documentclass{article}
\usepackage{amsthm,hyperref}
\bibliographystyle{amsalpha}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}\label{catfish}
\end{theorem}
\autoref{catfish} implies the truth of \autoref{god}.
\bibliography{bibshort}{}
\end{document}.
tobiasBora
  • 8,684

1 Answers1

1
\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\newtheorem{theorem}{Theorem}
\usepackage{etoolbox,xcolor}
\makeatletter
\patchcmd\HyRef@autosetref{\bfseries ??}{\missingreftext}{}{\fail}
\newcommand\missingreftext{\textcolor{red}{missing ref}}
\makeatother
\begin{document}
\begin{theorem}\label{catfish}
\end{theorem}
\autoref{catfish} implies the truth of  \autoref{god}.
\end{document}

enter image description here

Ulrike Fischer
  • 327,261