Problem:
I need to have URLs via \href{}{} be colored in blue text in the presentation. However, using \hypersetup{colorlinks=true,linkcolor = blue} changes the text in the section, subsection text in the headline, and the title text in the footline. These changes are problematic given the background color of the areas are blue.
Need:
I would really appreciate a better modification for section and subsection on the order of the first possible solution with the \renewcommand\insertshortitle or at least a pointer in the direction I should go.
The goal is to be able to use the modification to create a beamer theme.
Possible fixes (sorta):
I've found a few ideas and have implemented them with varying success found is to disable auto-coloring links. This has lead me to do \textcolor{blue}{\href{}{}}, which is not ideal.
In Beamer: hyperlinks and short title colors
There is a proposed solution with shorttitle:
\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
I have not been able to make this work with \insertsectionhead and \insertsubsectionhead. I would prefer this alternative to defining a new method for \href's.
There was another idea on how to disable linking here: How to remove link from title in foot
The main idea was to use: \let\hyperlink\@secondoftwo
to suppress the creation of the link.
I marked it up using headline
\setbeamertemplate{headline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right,rightskip=1em]{section in head/foot}%
\usebeamerfont{subsection in head/foot}\hspace*{2ex} \let\hyperlink\@secondoftwo\insertsectionhead
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left,leftskip=1em]{subsection in head/foot}%
\usebeamerfont{section in head/foot} \let\hyperlink\@secondoftwo\insertsubsectionhead \hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
However, this approach appends secondoftwo to the section and subsection strings.
The last option I have come across and implemented seems to have resolve the issue with the only downside being I have to include a new package (etoolbox). The idea came from:
errors with MakeUppercase and Beamer's insertsectionhead
\usepackage{etoolbox}
\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
MWE (visual of what's wrong)
\documentclass{beamer}
%normal
\usepackage{color}
\usepackage{beamerthemebars}
\usepackage{lmodern}
\usetheme{AnnArbor}
\usecolortheme{wolverine}
\setbeamercolor{palette tertiary}{bg=blue,fg=white}
\setbeamercolor{palette secondary}{bg=gray,fg=white}
\setbeamercolor{palette primary}{bg=pink,fg=white}
\beamertemplatenavigationsymbolsempty %hides navigation.
\usepackage{hyperref}
\usepackage{amssymb,amsmath}
\author[Coatless]{Lack of Coat}
\institute[Uni]{Uni All}
\date[Date]{\today}
\title[Title]{Fake Presentation}
\begin{document}
\section{Section naught}
\subsection{Subsection Ya}
\hypersetup{colorlinks=true,urlcolor=blue,linkcolor = blue}
% link color causes the section, subsection, and title to fg (font color) to be blue
\frame{\titlepage}
\hypersetup{colorlinks=false,urlcolor=blue,linkcolor = white}
% link color causes the section, subsection, and title to fg (font color) to be white
\frame{\titlepage}
\end{document}
Preview:
etoolbox
solution or not. Is there some reason you don't want to post that solution as an answer?