1

I am trying to customize my themes, but also would like to use hyperref to get quick links for ease of navigation. However, hyperref seems to replace the color of all contents to its linkcolor option.

enter image description here

The MWE shows that the section and subsection titles colors are blue but I actually sat them to orange and white.

The answer in Changing hyperlink color changes beamer section header colors proposes not using \hypersetup, but I would like to use it anyway because colored equations referencing makes it easier to find equations quickly and see where they are used in text. Can I enable link coloring as normal but exclude sections and subsections?

Here is the result I want

enter image description here

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

\usecolortheme{seahorse}
\setbeamercolor{palette primary}{fg=black, bg=LemonChiffon2}
\setbeamercolor{palette secondary}{fg=white, bg=DarkOrange2}
\setbeamercolor{palette tertiary}{fg=black, bg=white}
\setbeamercolor{palette quaternary}{fg=black, bg=white}

\useoutertheme[]{miniframes}
\setbeamercolor{section in head/foot}{fg=DarkOrange2}
\setbeamercolor{subsection in head/foot}{fg=white}
\setbeamertemplate{section in head/foot shaded}[default][30] 


\useinnertheme{inmargin}
\setbeamersize{sidebar width left=1cm, sidebar width right=1cm}
\setbeamersize{text margin left=0.5mm, text margin right=0.5mm}
\setbeamercovered{transparent=30}

\usepackage{hyperref}
\hypersetup{linkcolor=DodgerBlue3, colorlinks=true}



\begin{document}

\section{My Section}

\subsection{My Subsection}

\begin{frame}
contents
\end{frame}

\section{My Section}

\subsection{My Subsection}

\begin{frame}
contents
\end{frame}

\section{My Section}

\subsection{My Subsection}

\begin{frame}
contents
\end{frame}

\end{document}
  • Don't load \usepackage{hyperref}, beamer already loads it for you – user36296 Mar 23 at 11:20
  • Does it really make difference if I loaded it? I load all packages even if I know that the class loads them. This is just because I write my own notes about each package and what commands I need from it. It also helps me copy preambles from one document to another – Al-Motasem Aldaoudeyeh Mar 23 at 11:34
  • If you load packages that are already loaded, you risk option clashes. So better avoid this by only loading the packages you really need for this specific document. – user36296 Mar 23 at 11:37
2

You can disable the coloring of links in the headline template:

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

\usecolortheme{seahorse}
\setbeamercolor{palette primary}{fg=black, bg=LemonChiffon2}
\setbeamercolor{palette secondary}{fg=white, bg=DarkOrange2}
\setbeamercolor{palette tertiary}{fg=black, bg=white}
\setbeamercolor{palette quaternary}{fg=black, bg=white}

\useoutertheme[]{miniframes}
\setbeamercolor{section in head/foot}{fg=DarkOrange2}
\setbeamercolor{subsection in head/foot}{fg=white}
\setbeamertemplate{section in head/foot shaded}[default][30]


\useinnertheme{inmargin}
\setbeamersize{sidebar width left=1cm, sidebar width right=1cm}
\setbeamersize{text margin left=0.5mm, text margin right=0.5mm}
\setbeamercovered{transparent=30}

\usepackage{hyperref}
\hypersetup{linkcolor=DodgerBlue3, colorlinks=true}

\makeatletter
\newcommand\disablecolorlinks{\def\HyColor@UseColor##1{}}
\makeatletter
\addtobeamertemplate{headline}{\disablecolorlinks{}}{}



\begin{document}

\section{My Section}

\subsection{My Subsection}

\begin{frame}
contents
\begin{equation}
a
\label{eq}
\end{equation}
\end{frame}

\section{My Section}

\subsection{My Subsection}

\begin{frame}
contents \ref{eq}
\end{frame}

\section{My Section}

\subsection{My Subsection}

\begin{frame}
contents
\end{frame}

\end{document}

enter image description here

  • This will set only one color for sections in the secondary palette and tertiary palette. I would like white colored text in the secondary palette and orange colored text in the tertiary – Al-Motasem Aldaoudeyeh Mar 23 at 11:14
  • Hm. Not sure if I get what color you want, but you could try \makeatletter \newcommand\disablecolorlinks{\def\HyColor@UseColor##1{}} \addtobeamertemplate{headline}{\disablecolorlinks{}}{} – Ulrike Fischer Mar 23 at 11:26
  • Yes, this works. Would you like to update your answer to accept it? – Al-Motasem Aldaoudeyeh Mar 23 at 11:32
  • I edited the answer. – Ulrike Fischer Mar 23 at 11:41
  • Good. Thanks for the help :) – Al-Motasem Aldaoudeyeh Mar 23 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.