首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >hyperref包:如何仅对引用进行着色

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

Stack Overflow用户
提问于 2022-03-17 10:18:06
回答 1查看 1.2K关注 0票数 -1

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

例如,在这里:

代码语言:javascript
复制
\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} 

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

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-17 11:39:08

我不会用光束激活colorlinks。这可以打破精心设计的色彩主题,有时非常令人惊讶的地方。

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

代码语言:javascript
复制
\documentclass{beamer}

\usetheme{metropolis}

\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} 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71510620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档