4

I have a beamer presentation, and I found some code to make a slide with just the section title at the start of each section. When I add \hypersetup{colorlinks=true} at the beginning, the color of these section titles change. Maybe they're somehow interpreted as links?

With colorlinks=true, we get the following:

with colorlinks=true

With colorlinks=false, we get the following: with colorlinks=false

So I guess hyperref is making these section titles into links, and then coloring them. How do I prevent that? Or at least get the coloring right?

The code:

\documentclass[english,aspectratio=169,handout]{beamer}
\hypersetup{colorlinks=true}

\definecolor{BBGblue}{RGB}{13,157,219}
\setbeamercolor{structure}{fg=BBGblue}
\setbeamercolor{title}{fg=BBGblue}
\setbeamercolor{frametitle}{fg=BBGblue}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\begin{document}

\section{Want this to be BBGblue}
\begin{frame}{This is blue -- good}
\end{frame}

\section{This should be BBGblue too}
\begin{frame}{This is blue too}
\end{frame}

\end{document}
Mensch
  • 65,388
DavidR
  • 143

2 Answers2

3

You can temporarily switch off the link colouring by using \hypersetup{hidelinks} in front of \insertsectionhead.

\documentclass[english,aspectratio=169,handout]{beamer}
\hypersetup{colorlinks=true}

\definecolor{BBGblue}{RGB}{13,157,219}
\setbeamercolor{structure}{fg=BBGblue}
\setbeamercolor{title}{fg=BBGblue}
\setbeamercolor{frametitle}{fg=BBGblue}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}%
    \hypersetup{hidelinks}%
    \insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\begin{document}

\section{Want this to be BBGblue}
\begin{frame}{This is blue -- good}
\end{frame}

\section{This should be BBGblue too}
\begin{frame}{This is blue too}
\end{frame}

\end{document}
1

You can use the "color-hammer", the hyperref option allcolors=BBGblue like this:

\documentclass[english,aspectratio=169,handout]{beamer}
\hypersetup{%
  colorlinks=true,
  linkcolor=BBGblue, % All links are colored in BBGblue
  allcolors=BBGblue % change all colors to blue ... <===================
}

\definecolor{BBGblue}{RGB}{13,157,219}
\setbeamercolor{structure}{fg=BBGblue}
\setbeamercolor{title}{fg=BBGblue}
\setbeamercolor{frametitle}{fg=BBGblue}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\begin{document}

\section{Want this to be BBGblue}
\begin{frame}{This is blue -- good}
\end{frame}

\section{This should be BBGblue too}
\begin{frame}{This is blue too}
\end{frame}

\end{document}

with the wished result:

enter image description here

Mensch
  • 65,388
  • 1
    Ah. I want the section titles to be BBGblue, but I still want \href's a different color, so we can tell they're links. I guess the issue is that the section titles are also links -- so how to treat them differently? – DavidR Oct 17 '17 at 22:56