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}.
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

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.