\section{Proof of Theorem~\ref{thm:main}}
doesn't produce the correct pdf bookmark (using the hyperref package).
\section{Proof of \texorpdfstring{Theorem~\ref{thm:main}}{Theorem 3.1.7}}
would give the wished result (\texorpdfstring and Header setting), but since "3.1.7" is hard coded I have to change this line of code every time when I rearrange my text.
I understand that many mathematical forumalas cannot be used as pdf strings (pdf bookmarks) since they don't have a Unicode representation (Automatically add \texorpdfstring for math-mode in section titles).
But "Theorem 3.1.7" only contains plain ASCII symbols. So at least theoretically it should be possible to implement an automatic solution for that.
Ideally I would like to have code that allows me to just write:
\section{Proof of \Cref{thm:main}}
(by using the cleveref package, but a solution for \ref would already be very helpful too)
Example:
\documentclass{article}
\usepackage{hyperref}
\usepackage{cleveref}
\newtheorem{theorem}{Theorem}[section]
\begin{document}
\begin{theorem}\label{thm:main}
text
\end{theorem}
many pages
\section{Proof of \Cref{thm:main}}
\end{document}
(this code does not give the correct pdf bookmarks)
(PS: I think this would be a really great to include such a code in the hypperref or in the cleveref package)