2

When I use \hypersetup to change the link colors for the outline of my presentation, it also changes the colors of the section and subsection titles in the header. I have some code that I believe should override this based on \patchcmd, but it doesn't seem to work. When I add \tracingpatches it does not report any issues. How can I get the section/subsection to show up as white instead of black?

MWE:

\documentclass{beamer}

\usetheme{AnnArbor}

\usepackage{multicol}

\definecolor{beamer@myBlue}{RGB}{19,41,75}
\definecolor{beamer@myOrange}{RGB}{232,74,39}
\definecolor{beamer@myGray}{RGB}{210,210,210}

\setbeamercolor{frametitle}{fg=beamer@myBlue,bg=beamer@myGray}
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{title}{fg=beamer@myBlue,bg=beamer@myOrange!75}
\setbeamercolor{item projected}{fg=white,bg=beamer@myOrange}
\setbeamercolor{block title}{fg=beamer@myBlue,bg=beamer@myOrange}
\setbeamercolor{block body}{fg=blue,bg=beamer@myBlue!80}
\setbeamercolor{title in head/foot}{fg=beamer@myBlue,bg=beamer@myGray}
\setbeamercolor{author in head/foot}{fg=white,bg=beamer@myBlue}
\setbeamercolor{institute in head/foot}{fg=white,bg=beamer@myOrange}
\setbeamercolor{date in head/foot}{fg=white,bg=beamer@myOrange}
\setbeamercolor{section in head/foot}{fg=white,bg=beamer@myBlue}
\setbeamercolor{subsection in head/foot}{fg=white,bg=beamer@myOrange}

\hypersetup{colorlinks,linkcolor=black}

\makeatletter
\renewcommand\insertshorttitle[1][]{%
    \beamer@setupshort{#1}%
    \let\thanks=\@gobble%
    \ifnum\c@page=1%
    \hyperlinkpresentationend{\beamer@insertshort{\usebeamercolor*[fg]{title in head/foot}\beamer@shorttitle}}%
    \else%
    \hyperlinkpresentationstart{\beamer@insertshort{\usebeamercolor*[fg]{title in head/foot}\beamer@shorttitle}}%
    \fi}
\makeatother

\makeatletter
\patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{\usebeamercolor*[fg]{section in head/foot}#1}}}
{}{}
\patchcmd{\beamer@subsection}
{\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{\usebeamercolor*[fg]{subsection in head/foot}#1}}}
{}{}
\makeatother

\beamertemplatenavigationsymbolsempty

\begin{document}

%% Presentation info
\title[Test]{
This is a test of my template
}

\author[J.~Smith]{John Smith}

\institute[A]{Affiliation}

\date[Jan. 15, 2019]{January 15, 2019}
%%%%

%% Titlepage
\begin{frame}[plain]
\titlepage
\end{frame}
%%%%

%% Outline
\begin{frame}
    \frametitle{Outline}
    \begin{multicols}{2}
        \tableofcontents
    \end{multicols}
\end{frame}
%%%%

%%% Other slides start here

\section{Introduction}
\subsection{Overview}

\begin{frame}
\frametitle{Example}
\begin{itemize}
    \item Here is a list:
    \begin{itemize}
        \item A
        \item B
        \item C
        \item D
        \item E
    \end{itemize}
    \item And another one:
    \begin{itemize}
        \item 1
        \item 2
        \item 3
    \end{itemize}
\end{itemize}
\end{frame}

\section{Conclusion}
\subsection{Review}

\begin{frame}
\frametitle{Example}
\begin{itemize}
    \item Here is a list:
    \begin{itemize}
        \item A
        \item B
        \item C
        \item D
        \item E
    \end{itemize}
    \item And another one:
    \begin{itemize}
        \item 1
        \item 2
        \item 3
    \end{itemize}
\end{itemize}
\end{frame}

\newcounter{finalframe}
\setcounter{finalframe}{\value{framenumber}}

\end{document}

1 Answer 1

2

Instead of messing with the \hypersetup you can change the colours of toc entries with \setbeamercolor{section in toc}{fg=green}

\documentclass{beamer}

\usetheme{AnnArbor}

\usepackage{multicol}

\definecolor{beamer@myBlue}{RGB}{19,41,75}
\definecolor{beamer@myOrange}{RGB}{232,74,39}
\definecolor{beamer@myGray}{RGB}{210,210,210}

\setbeamercolor{frametitle}{fg=beamer@myBlue,bg=beamer@myGray}
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{title}{fg=beamer@myBlue,bg=beamer@myOrange!75}
\setbeamercolor{item projected}{fg=white,bg=beamer@myOrange}
\setbeamercolor{block title}{fg=beamer@myBlue,bg=beamer@myOrange}
\setbeamercolor{block body}{fg=blue,bg=beamer@myBlue!80}
\setbeamercolor{title in head/foot}{fg=beamer@myBlue,bg=beamer@myGray}
\setbeamercolor{author in head/foot}{fg=white,bg=beamer@myBlue}
\setbeamercolor{institute in head/foot}{fg=white,bg=beamer@myOrange}
\setbeamercolor{date in head/foot}{fg=white,bg=beamer@myOrange}
\setbeamercolor{section in head/foot}{fg=white,bg=beamer@myBlue}
\setbeamercolor{subsection in head/foot}{fg=white,bg=beamer@myOrange}

\setbeamercolor{section in toc}{fg=green}
\setbeamercolor{subsection in toc}{fg=green}

\beamertemplatenavigationsymbolsempty

%% Presentation info
\title[Test]{
This is a test of my template
}

\author[J.~Smith]{John Smith}

\institute[A]{Affiliation}

\date[Jan. 15, 2019]{January 15, 2019}

\begin{document}


%%%%

%% Titlepage
\begin{frame}[plain]
\titlepage
\end{frame}
%%%%

%% Outline
\begin{frame}
    \frametitle{Outline}
    \begin{multicols}{2}
        \tableofcontents
    \end{multicols}
\end{frame}
%%%%

%%% Other slides start here

\section{Introduction}
\subsection{Overview}

\begin{frame}
\frametitle{Example}
\begin{itemize}
    \item Here is a list:
    \begin{itemize}
        \item A
        \item B
        \item C
        \item D
        \item E
    \end{itemize}
    \item And another one:
    \begin{itemize}
        \item 1
        \item 2
        \item 3
    \end{itemize}
\end{itemize}
\end{frame}

\section{Conclusion}
\subsection{Review}

\begin{frame}
\frametitle{Example}
\begin{itemize}
    \item Here is a list:
    \begin{itemize}
        \item A
        \item B
        \item C
        \item D
        \item E
    \end{itemize}
    \item And another one:
    \begin{itemize}
        \item 1
        \item 2
        \item 3
    \end{itemize}
\end{itemize}
\end{frame}

\newcounter{finalframe}
\setcounter{finalframe}{\value{framenumber}}

\end{document}

enter image description here

2
  • Thanks! Nice to know there's a much simpler way to do it
    – astay13
    Commented Jan 16, 2019 at 1:44
  • @astay13 You're welcome! Commented Jan 16, 2019 at 9:11

You must log in to answer this question.

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