Beamer:超链接和短标题颜色

Beamer:超链接和短标题颜色

考虑以下 MWE

\documentclass[leqno]{beamer}

\usetheme{Madrid}
\usecolortheme{whale}

\usepackage{lmodern}
\hypersetup{colorlinks=true, allcolors=blue}

\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}

我希望我的短标题前景色为白色,超链接为蓝色。但是设置 colorlinks=true, allcolors=blue也会将短标题设置为蓝色。我尝试设置,\setbeamercolor{title in head/foot}{fg=white}但似乎没有任何效果。

在此处输入图片描述

我找到了这个回答显然解决了相同/相似的问题。为了更改短标题的颜色,是否还需要(唯一可用的解决方法)暂时禁用页脚中的超链接功能?

答案1

您可以使用以下方法更改为模板中的allcolors当前颜色.footline

\addtobeamertemplate{footline}{\hypersetup{allcolors=.}}{}

在此处输入图片描述

代码:

\documentclass[leqno]{beamer}

\usetheme{Madrid}
\usecolortheme{whale}

\usepackage{lmodern}
\hypersetup{colorlinks=true, allcolors=blue}
\addtobeamertemplate{footline}{\hypersetup{allcolors=.}}{}

\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}

答案2

我不确定是否有理由不这样做,但非常匆忙的测试表明超链接有效并且短标题以白色显示:

\documentclass[leqno]{beamer}

\usetheme{Madrid}
\usecolortheme{whale}

\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

\usepackage{lmodern}
\hypersetup{colorlinks=true, allcolors=blue}

\title[Short title]{Title}
\author{John Doe}
\date{\today}

\begin{document}
  \begin{frame}
    \titlepage
  \end{frame}

\begin{frame}
  \begin{equation}
  \label{eq:foo}
      2 + 2 = 4
  \end{equation}

  Hyperlink: \ref{eq:foo}
\end{frame}
\end{document}

[我添加了标题页只是为了检查超链接是否真的起了作用。]

白色的超链接短标题?

更新使用 samcarter 的建议,以增强灵活性。

相关内容