命令 \hypersetup{colorlinks=true} 更改节标题的颜色

命令 \hypersetup{colorlinks=true} 更改节标题的颜色

我有一个beamer演示文稿,我找到了一些代码来制作一张幻灯片,每个部分的开头只显示部分标题。当我\hypersetup{colorlinks=true}在开头添加时,这些部分标题的颜色会发生变化。也许它们以某种方式被解释为链接?

通过colorlinks=true,我们得到以下信息:

使用 colorlinks=true

通过colorlinks=false,我们得到以下信息: 使用 colorlinks=false

所以我猜hyperref是将这些部分标题变成链接,然后给它们上色。我该如何避免这种情况?或者至少让颜色正确?

代码:

\documentclass[english,aspectratio=169,handout]{beamer}
\hypersetup{colorlinks=true}

\definecolor{BBGblue}{RGB}{13,157,219}
\setbeamercolor{structure}{fg=BBGblue}
\setbeamercolor{title}{fg=BBGblue}
\setbeamercolor{frametitle}{fg=BBGblue}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\begin{document}

\section{Want this to be BBGblue}
\begin{frame}{This is blue -- good}
\end{frame}

\section{This should be BBGblue too}
\begin{frame}{This is blue too}
\end{frame}

\end{document}

答案1

您可以使用“color-hammer”,选项hyperref如下allcolors=BBGblue

\documentclass[english,aspectratio=169,handout]{beamer}
\hypersetup{%
  colorlinks=true,
  linkcolor=BBGblue, % All links are colored in BBGblue
  allcolors=BBGblue % change all colors to blue ... <===================
}

\definecolor{BBGblue}{RGB}{13,157,219}
\setbeamercolor{structure}{fg=BBGblue}
\setbeamercolor{title}{fg=BBGblue}
\setbeamercolor{frametitle}{fg=BBGblue}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\begin{document}

\section{Want this to be BBGblue}
\begin{frame}{This is blue -- good}
\end{frame}

\section{This should be BBGblue too}
\begin{frame}{This is blue too}
\end{frame}

\end{document}

得到期望的结果:

在此处输入图片描述

答案2

\hypersetup{hidelinks}您可以在前面使用 暂时关闭链接颜色\insertsectionhead

\documentclass[english,aspectratio=169,handout]{beamer}
\hypersetup{colorlinks=true}

\definecolor{BBGblue}{RGB}{13,157,219}
\setbeamercolor{structure}{fg=BBGblue}
\setbeamercolor{title}{fg=BBGblue}
\setbeamercolor{frametitle}{fg=BBGblue}

\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}%
    \hypersetup{hidelinks}%
    \insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}

\begin{document}

\section{Want this to be BBGblue}
\begin{frame}{This is blue -- good}
\end{frame}

\section{This should be BBGblue too}
\begin{frame}{This is blue too}
\end{frame}

\end{document}

相关内容