[Tex/LaTex] Change \ref text

hyperref

I wonder whether I can change displayed text in \ref globally for a \label referencing a numbered environment. Concretely:

Let's suppose I have a theorem called "Important Proof".

\begin{theorem}[Important Proof]\label{IP}
Trivial.
\end{theorem}

Then \ref{IP} would display something like 1.1.1. I however want to change that text only sporadically, so that this specific proof gets displayed e.g. with Important Proof, but all other proofs stay unaffected.

What did I mean with globally? I saw some workarounds using \hyperref every single time, but this does not seem really convincing; I would like to have some kind of redefinition, so that I can just use something like \ref s.t. I don't have to insert the text every single time manually.

Best Answer

\documentclass{article}
\usepackage{hyperref}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}[Important Proof]%
\makeatletter\def\@currentlabel{Important Proof}\makeatother
\label{IP}
Trivial.
\end{theorem}

\ref{IP}
\end{document}

enter image description here

Related Question