I had a problem that was solved in a previous question, and that now is coming back.
The idea was to use \ref
for internal links with color A, and \cref
with nameinlink
option in cleveref
(!) and color B for links with mathematical content.
Audrey Blumsohn kindly provided me the following solution:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[usenames,dvipsnames]{xcolor}
\newtheorem{theorem}{Theorem}
\usepackage{varioref}
\usepackage{hyperref}
\usepackage[noabbrev,capitalise,nameinlink]{cleveref}
\hypersetup{colorlinks={true},linkcolor={blue},citecolor=green}
\newcommand{\mref}[3][red]{\hypersetup{linkcolor=#1}\cref{#2}{#3}\hypersetup{linkcolor=blue}}%<<<changed
\begin{document}
\section{Bla}
\label{sec:bla}
\begin{theorem}
\label{th:gauss}
Gauss
\end{theorem}
\section{blabla}
In section \ref{sec:bla} we found \mref{th:gauss}
And again \ref{sec:bla} we found \mref{th:gauss}
\end{document}
But still there is a problem. Namely, this solution does not work when I use it for cross-referencing in a proof environment, to get something like
Proof of the theorem 1.
that in principle I should write
\begin{proof}[Proof of \mref{thm:1}]
with 'theorem 1' written by using \mref
.
Is there a way to get the result?
Thanks a lot in advance!