beamer icon indicating copy to clipboard operation
beamer copied to clipboard

Underlined hyperlinks displayed on every slide of a frame

Open dbitouze opened this issue 6 years ago • 8 comments

(Not sure if this issue should be reported here or on hyperref repository.)

The following MCE points out that hyperlinks, if underlined, are displayed on every slide of a frame, even if they shouldn't be.

\documentclass{beamer}
\hypersetup{colorlinks=false,pdfborderstyle={/S/U/W 1}}
\begin{document}
\begin{frame}
  foo
  \pause{}%
  \href{bar}{bar}
\end{frame}
\end{document}

dbitouze avatar Jan 15 '20 15:01 dbitouze

If at all possible, I would avoid changing the hypersetup for beamer. This would influence all kinds of elements like navigation symbols, head- and footlines ...

Why not underline the links you need?

\documentclass{beamer}
%\hypersetup{colorlinks=false,pdfborderstyle={/S/U/W 1}}
\usepackage{soul}
\begin{document}
\begin{frame}
  foo
  \pause{}%
 \href{bar}{\ul{bar}}
\end{frame}
\end{document}

samcarter avatar Jan 15 '20 15:01 samcarter

The problem is: it is a pain if you need to underline all the links :smiley:

dbitouze avatar Jan 15 '20 15:01 dbitouze

How about defining a new command instead of \href that underlines them?

samcarter avatar Jan 15 '20 15:01 samcarter

In fact, not only \href hyperlinks are concerned. For instance (and in my real use case), also hyperlinks provided by the tcolorbox's documentation library (such as the ones generated by \refCom); but maybe specifically for these tcolorbox hyperlinks, I should open an issue there.

dbitouze avatar Jan 15 '20 15:01 dbitouze

Could you make a MWE? Maybe one can find some workaround?

samcarter avatar Jan 15 '20 16:01 samcarter

Oooops, sorry, I see your message too late: I reported an issue on tcolorbox repository.

But here is a MCE with beamer:

\documentclass{beamer}
\usepackage{tcolorbox}
\tcbuselibrary{documentation}

\tcbset{color command=red, color key=blue}

\hypersetup{colorlinks=false,pdfborderstyle={/S/U/W 1}}

\begin{document}

\begin{frame}
  \begin{docCommand}{foomakedocSubKey}{\marg{name}\marg{key path}}
  \end{docCommand}

  \pause{}

  See \refCom*{foomakedocSubKey}
\end{frame}
\end{document}

dbitouze avatar Jan 15 '20 16:01 dbitouze

You could add the underline to the definition of the \ref...* commands:

\documentclass{beamer}
\usepackage{tcolorbox}
\tcbuselibrary{documentation}

\makeatletter
\ExplSyntaxOn   
\DeclareDocumentCommand\tcb@ref@doc{msm}{%
  \hyperref[#1:#3]{\ttfamily\underline{\ref*{#1:#3}}%
  \IfBooleanTF{#2}{}{%
    \ifnum\getpagerefnumber{#1:#3}=\thepage%
    \else%
      \textsuperscript{\ding{213}\,\kvtcb@text@pageshort\,\pageref*{#1:#3}}%
    \fi}}%
}
\ExplSyntaxOff   
\makeatother

\begin{document}

\begin{frame}
  \begin{docCommand}{foomakedocSubKey}{\marg{name}\marg{key path}}
  \end{docCommand}

  \pause{}

  See \refCom*{foomakedocSubKey} and
\end{frame}
\end{document}

And if one already goes there and modifies the definition, one could also remove the pageref to solve your problem with the unstarred version of \refCom and beamer (https://github.com/T-F-S/tcolorbox/issues/63):

\documentclass{beamer}
\usepackage{tcolorbox}
\tcbuselibrary{documentation}

\makeatletter
\ExplSyntaxOn   
\DeclareDocumentCommand\tcb@ref@doc{msm}{%
  \hyperref[#1:#3]{\ttfamily\underline{\ref*{#1:#3}}}%
}
\ExplSyntaxOff   
\makeatother

\begin{document}

\begin{frame}
  \begin{docCommand}{foomakedocSubKey}{\marg{name}\marg{key path}}
  \end{docCommand}

  \pause{}

  See \refCom{foomakedocSubKey} and
\end{frame}
\end{document}

samcarter avatar Jan 15 '20 17:01 samcarter

You could add the underline to the definition of the \ref...* commands:

Nice indeed! :smile: Thanks!

Nevertheless, I'm not sure this issue has to be considered as closed...

dbitouze avatar Jan 15 '20 17:01 dbitouze