Beamer 忽略 hyperref 中的 citecolor

Beamer 忽略 hyperref 中的 citecolor

我该如何引文Beamer 中的链接是绿色的?Beamer 似乎忽略了 hyperref 选项citecolor。我尝试改用该linkcolor选项,但这会影响所有链接(例如指向下一张幻灯片的链接,见下面的示例)。我想更改仅有的引用颜色。

\documentclass{beamer}

\hypersetup{
  colorlinks = true,
% linkcolor = green,
  citecolor = green
}

\begin{document}

\begin{frame}
This is a great result~\cite{Paper}.
But this is a link to slide~\ref{Bib}.
\end{frame}

\begin{frame}{Bibliography}\label{Bib}
\begin{thebibliography}{}
  \bibitem[Author, 1942]{Paper}
    Author. B.
    \newblock The great result.
\end{thebibliography}
\end{frame}

\end{document}

答案1

您可以重新定义\@cite以本地更改链接颜色:

\documentclass{beamer}

\hypersetup{
  colorlinks = true,
  linkcolor = red
}

\makeatletter
\let\@mycite\@cite
\def\@cite#1#2{{\hypersetup{linkcolor=green!60!black}[{#1\if@tempswa , #2\fi}]}}
\makeatother

\begin{document}

\begin{frame}
This is a great result~\cite{Paper}.
But this is a link to slide~\ref{Bib}.
\end{frame}

\begin{frame}{Bibliography}\label{Bib}
\begin{thebibliography}{}
  \bibitem[Author, 1942]{Paper}
    Author. B.
    \newblock The great result.
\end{thebibliography}
\end{frame}

\end{document}

在此处输入图片描述

答案2

上述解决方案对我来说不起作用。但我通过在序言中添加以下行成功了:

\let\oldcite=\cite                                                              
\renewcommand{\cite}[1]{\textcolor[rgb]{.7,.7,.7}{\oldcite{#1}}}

相关内容