[Tex/LaTex] Reference to proof prints section instead

cleverefcross-referencinghyperref

I have several theorems in a document with the proofs in the appendix. After some theorem, I want to refer to the proof and, using the hyperref package, I want to make the reference clickable to avoid scrolling.

However, adding a label to the proof and then referring to it (I am also using the cleveref package) refers and links to the respective section which holds the proof instead, in my example to the appendix.

MWE:

\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{cleveref}
\newtheorem{theorem}{Theorem}

\begin{document}
\section{Theorems}
\begin{theorem}\label{thm:some-theorem}
This is a theorem.
\end{theorem}

For an initution, see the proof.

For an intiution, see \cref{proof:some-theorem}.

\appendix
\section{Proofs}
\begin{proof}[Proof of \Cref{thm:some-theorem}]
\label{proof:some-theorem}
This is a proof.
\end{proof}
\end{document}

enter image description here

How can I get the reference to print "proof" (or "proof of Theorem 1") instead, with the hyperlink also linking to the proof?

Best Answer

You can make bidirectional links using the same label.

\documentclass{article}
\usepackage{amsthm}
\usepackage[colorlinks]{hyperref}
\usepackage{cleveref}

\newtheorem{theorem}{Theorem}
\newenvironment{delayedproof}[1]
 {\begin{proof}[\raisedtarget{#1}Proof of \Cref{#1}]}
 {\end{proof}}
\newcommand{\raisedtarget}[1]{%
  \raisebox{\fontcharht\font`P}[0pt][0pt]{\hypertarget{#1}{}}%
}
\newcommand{\proofref}[1]{\hyperlink{#1}{proof}}

\begin{document}
\section{Theorems}
\begin{theorem}\label{thm:some-theorem}
This is a theorem.
\end{theorem}

For an intuition, see the \proofref{thm:some-theorem}.

\appendix
\section{Proofs}
\begin{delayedproof}{thm:some-theorem}
This is a proof.
\end{delayedproof}
\end{document}

enter image description here

The picture shows that the link “proof” refers to the correct proof. Raising the \hypertarget is needed or the link would point to the baseline of the proof's first line.

Related Question