\insertshorttitle
当在脚注(或其他地方)使用时,它会自动插入为可点击的链接。
因此,例如,它以不同的颜色排版。(在图像中用红色圆圈标记,其中标题显示为黑色而不是蓝色)
如何禁止这种行为?
\documentclass{beamer}
\setbeamertemplate{footline}{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
}%
\vskip0pt%
}
\title{test}
\author{Einstein}
\begin{document}
\begin{frame}
test
\end{frame}
\end{document}
答案1
链接是不是罪魁祸首是标题的颜色与页脚中作者的颜色不同。
themes/outer/beamerouterthememiniframes.sty
定义:
\setbeamercolor{section in head/foot}{parent=palette tertiary}
\setbeamercolor{subsection in head/foot}{parent=palette secondary}
\setbeamercolor{author in head/foot}{parent=subsection in head/foot}
\setbeamercolor{title in head/foot}{parent=section in head/foot}
不同的颜色是一种属性title in head/foot
,可以改变,例如:
\setbeamercolor{title in head/foot}{parent=subsection in head/foot}
链接颜色可以通过以下方式禁用
\hypersetup{allcolors={}}
或更完整:
\hypersetup{hidelinks}
这也会删除链接边框。
完整示例:
\documentclass{beamer}
\hypersetup{
colorlinks,
linkcolor=red,
}
\setbeamercolor{title in head/foot}{parent=subsection in head/foot}
\setbeamertemplate{footline}{%
\leavevmode
\hbox{%
\begin{beamercolorbox}[
wd=.333333\paperwidth,
ht=2.25ex,
dp=1ex,
center
]{author in head/foot}%
\usebeamerfont{author in head/foot}%
\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[
wd=.333333\paperwidth,
ht=2.25ex,
dp=1ex,
center
]{title in head/foot}%
\usebeamerfont{title in head/foot}%
% disable color in links
% \hypersetup{allcolors={}}%
\hypersetup{hidelinks}%
\insertshorttitle
\end{beamercolorbox}%
}%
\par
\vspace{0pt}%
}
\title{test}
\author{Einstein}
\begin{document}
\begin{frame}
test
\begin{equation}
\label{eq:einstein}
E=mc^2
\end{equation}
\vspace{0pt plus 5fill}
A reference to an \hyperref[eq:einstein]{equation}
to show the link color.
\end{frame}
\end{document}
答案2
您可以关闭hyperref
页脚中的暂时功能:
\documentclass{beamer}
\let\Tiny=\tiny% https://tex.stackexchange.com/q/58087/5764
\makeatletter
\setbeamertemplate{footline}{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\let\hyperlink\@secondoftwo\insertshorttitle
\end{beamercolorbox}%
}%
\vskip0pt%
}
\makeatother
\title{test}
\author{Einstein}
\begin{document}
\begin{frame}
test
\end{frame}
\end{document}
\insertshorttitle
插入一个\hyperlink{<target>}{<title>}
,其中<title>
是演示文稿中显示的格式化标题。我\let\hyperlink\@secondoftwo
刚刚插入了\insertshorttitle
,这使得\hyperlink
只返回第二个参数 - 跳过整个超链接。由于这是在组内执行的(由 的...\begin
提供),因此重新定义或调整是临时的/范围有限的。\end
beamercolorbox
\let
额外的\makeatletter
...\makeatother
一对是必需的,因为在宏定义中\@secondoftwo
使用。@
答案3
在页脚分为三部分的主题中,例如 Boadilla,您可以使用以下内容,而不是其他答案:
\makeatletter
\setbeamertemplate{footline}{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\let\hyperlink\@secondoftwo\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}%
\usebeamerfont{date in head/foot}\let\hyperlink\@secondoftwo\insertshortdate
\end{beamercolorbox}%
}%
\vskip0pt%
}
\makeatother
\expandafter\def\expandafter\insertshortdate\expandafter{%
\insertshortdate\hfill%
\insertframenumber\,/\,\inserttotalframenumber}
这将保留章节标题和幻灯片计数器。