In this answer @cfr showed me how to preserve short title color in beamer while allowing hyperlinks to work. His solution was to modify the \insertshorttitle command (defined in beamerbasetitle.sty) like this:
\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
This works just fine but I want to know if it possible to just patch the \insertshorttitle command using etoolbox. I tried doing
\makeatletter
\patchcmd{\insertshorttitle}{\beamer@shorttitle}{\usebeamercolor*[fg]{title in head/foot}\beamer@shorttitle}{}{}
\makeatother
but it didn't work. etoolbox suggested that the command is not patchable because "the macro may have been defined under a category code regime different from the current one".
So my question is: can I patch the command somehow? Here is a complete MWE:
\documentclass[leqno]{beamer}
\usetheme{Madrid}
\usecolortheme{whale}
\usepackage{lmodern}
\usepackage{etoolbox}
\hypersetup{colorlinks=true, allcolors=blue}
\makeatletter
\patchcmd{\insertshorttitle}{\beamer@shorttitle}{\usebeamercolor*[fg]{title in head/foot}\beamer@shorttitle}{}{}
\makeatother
\title[Short title]{Title}
\author{John Doe}
\date{\today}
\begin{document}
\begin{frame}
\begin{equation}
\label{eq:foo}
2 + 2 = 4
\end{equation}
Hyperlink: \ref{eq:foo}
\end{frame}
\end{document}
\insertshorttitleis defined with an optional argument, so\patchcmddoesn't work. Use\xpatchcmdof thexpatchpackage. See Please tutor the usage of\patchcmdandxpatch– egreg Oct 05 '14 at 22:23etoolbox's output. I said it suggested 3 possible reasons of which 2 did not apply, which only left that one. What I mean is, I did not pretend to understand that explanation ;)! – cfr Oct 05 '14 at 22:33\renewcommand(as I did there), it works correctly even in the second frame. The hyperlink is created but the text does not show in the patched colour. – cfr Oct 05 '14 at 22:38\patchcmd(on which\xpatchcmdofxpatchis based) just patches the first occurrence. – egreg Oct 05 '14 at 22:41