1

In the MWE below, you will see that \cref is not working with hyperref. Also, even with the conventional \ref command, hyperref leads to the wrong equation

This is the output

enter image description here

This is where \ref takes us (right under Equation 1, instead of Equation 1 itself)

enter image description here

One solution is mentioned in cleveref hyperlink not working in beamer redefines \cref as follows

\let\chyperref\cref % Save the orginal command under a new name
\renewcommand{\cref}[1]{{\hyperlink{#1}{\chyperref{#1}}}} % Redefine the \cref command and explictely add the hyperlink. 

The solution above works only to reference only one equation. If multiple equations are referenced, hyperlink will always take us to the beginning of the document. This means that \cref with this solution is pretty much the same as \ref

\documentclass[aspectratio=169, xcolor={x11names}]{beamer}

\usecolortheme{seahorse}

\useoutertheme[]{miniframes}
\useinnertheme{inmargin}
\setbeamersize{sidebar width left=1cm, sidebar width right=1cm}
\setbeamersize{text margin left=0.5mm, text margin right=0.5mm}

\usepackage{hyperref}
\hypersetup{citecolor=SlateBlue2, citebordercolor=SlateBlue2, 
linkbordercolor=DodgerBlue3, linkcolor=DodgerBlue3, urlcolor=Blue1, colorlinks=true}

\usepackage{cleveref}

    % Single equations (non-breakable)
    \crefformat{equation}{\mbox{Eq. #2(#1)#3}}
    \crefrangeformat{equation}{\mbox{Eqs. #3(#1)#4 to #5(#2)#6}}
    \crefmultiformat{equation}{\mbox{Eqs. #2(#1)#3}}{ and #2(#1)#3}{, #2(#1)#3}{ and #2(#1)#3}
    \crefrangemultiformat{equation}{\mbox{Eqs. #3(#1)#4 to #5(#2)#6}}{ and #3(#1)#4 to #5(#2)#6}{, #3(#1)#4 to #5(#2)#6}{ and #3(#1)#4 to #5(#2)#6}

\let\chyperref\cref % Save the orginal command under a new name
\renewcommand{\cref}[1]{{\color{blue}\hyperlink{#1}{\chyperref{#1}}}} % Redefine the \cref command and explictely add the hyperlink. 

\begin{document}

\begin{frame}{Title Here}

    \begin{block}

        \begin{align}
            A  &= B
            \label{eq1}
            \\
             &= C
             \label{eq2}
             \\
             &= D
             \label{eq3}
        \end{align}

    \end{block}

\end{frame}


\begin{frame}{Title Here}

    \begin{block}

        \begin{align}
            A  &= B
            \label{eq4}
            \\
             &= C
             \label{eq5}
             \\
             &= D
             \label{eq6}
        \end{align}

    \end{block}

\end{frame}

\begin{frame}{Title Here}

\begin{block}

    \begin{align}
    A  &= B
    \label{eq7}
    \\
    &= C
    \label{eq8}
    \\
    &= D
    \label{eq9}
    \end{align}

\end{block}

\end{frame}

\begin{frame}
    contents in between
\end{frame}


\begin{frame}

    \cref{eq1} 

    \cref{eq1,,eq2}

    \cref{eq1,eq2,eq3} 

    \cref{eq1,eq2,eq3,eq7,eq8,eq9} 

    \cref{eq1,,eq2,,eq3,eq7,eq8,eq9} 

    \cref{eq6,eq7,eq9} 


    Eq. \ref{eq1} 
\end{frame}


\end{document}
1
  • 3
    Could you please add a screenshot of the output you get to your question? If I compile your code, I get the following in slide 3: eqs. (1) and (2) Eq. 1 Maybe interesting: cleveref hyperlink not working in beamer
    – leandriis
    Commented Mar 23, 2019 at 8:54

1 Answer 1

4

No, hyperrefs with cleverref and beamer don't work. You only need to compile a small beamer document with cleverref and then look in the log:

Package cleveref Warning: hyperref package loaded with implicit=false option - 
disabling cleveref's hyperref support. This situation is not supported by cleveref, 
and there's no guarantee anything will work. You're on your own! on input 
line 2370.
2
  • 1
    How is this helpful? I can see this error message myself, that's the reason I came here in the first place. Commented Nov 15, 2020 at 15:31
  • 1
    @NikitaSkybytskyi Not everyone looks in the log and see such message. And even less accept what is written there: "This is not supported" and "You're on your own!". Commented Nov 15, 2020 at 17:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .