hyperref 包:如何仅对引文进行着色

问题描述 投票:0回答:1

我想使用 hyperref 包仅对引文进行着色,但它似乎对每个链接都进行了着色。

例如这里:

\documentclass{article}
    
\usepackage{hyperref}
\hypersetup{
    citecolor  = blue,
        colorlinks = true,
    }
    
\begin{document}
        
\tableofcontents
\section{This title should be in red in the TOC}
        
This citation \cite{a} is blue.
        
\begin{thebibliography}{99}
   \bibitem{a} Andros, Using hyperref for a citation, StackExchange, 2022.
\end{thebibliography}
        
\end{document} 

我希望引文为蓝色,但我不希望目录中的项目为红色。

谢谢

latex beamer
1个回答
0
投票

我不会用投影仪激活

colorlinks
。这可能会在有时非常令人惊讶的地方打破精心构建的颜色主题。

您可以更改引文的文本颜色:

\documentclass{beamer}

\usetheme{moloch}% modern fork of the metropolis theme

\usepackage{xpatch}
\usepackage{xspace}

\makeatletter
\xpretocmd{\@citex}{\color{blue}}{}{}
\xapptocmd{\@citex}{\color{normal text.fg}\xspace}{}{}
\makeatother
\begin{document}
        
\begin{frame}
        
This citation \cite{a} is blue.
        
\begin{thebibliography}{99}
   \bibitem{a} Andros, Using hyperref for a citation, StackExchange, 2022.
\end{thebibliography}
        
\end{frame}        
\end{document} 
© www.soinside.com 2019 - 2024. All rights reserved.