我需要设置与两个屏幕截图相同的颜色:
如您所见,定理和图表编号为蓝色,引用为红色,目录为黑色,其编号为蓝色。如何实现这种组合?
这些是我必须更改的参数:
{\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=blue,
urlcolor=blue,
citecolor=blue,
%pdfpagemode=FullScreen,
}
\documentclass{book}
\usepackage{xcolor}
\colorlet{RED}{black} % don't color running headers
\colorlet{BLUE}{black}
\usepackage[titles]{tocloft}
\renewcommand{\cftchappresnum}{\color{red}}
\renewcommand{\cftchappagefont}{\bfseries\color{red}}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter[\color{red}This is the first chapter]{This is the first chapter}
\section{section}
\section{section}
\section{section}
\end{document}
答案1
设置参数如下:
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=blue,
urlcolor=blue,
citecolor=red,
linktoc=page
}
满足您的要求。该行linktoc=page
设置目录,使得只有页码(而不是章节/部分标题)是超链接。这导致只有页码被涂成蓝色。另请参阅这里。
如果您希望特定的参考或引文不被着色(例如在 a 中),您可以像这样包围相关代码(请注意包围整个块的minitoc
花括号):{}
{\hypersetup{linkcolor=black} % and/or citecolor=black
\minitoc % or any other content whose refs are not to be colored
}
这是一个最小工作示例:
\documentclass{book}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage[titles]{tocloft}
\usepackage{minitoc}
\usepackage{theorem}
\newtheorem{theorem}{Theorem}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=blue,
urlcolor=blue,
citecolor=red,
linktoc=page
%pdfpagemode=FullScreen,
}
\begin{document}
\dominitoc
\frontmatter
\tableofcontents
\mainmatter
\chapter{This is the first chapter}
{\hypersetup{linkcolor=black}
\minitoc
}
\section{section}
This is a citation~\cite{ref1}. Theorem~\ref{thm1} provides some interesting information.
\begin{theorem}\label{thm1}
Rain gets you wet.
\end{theorem}
\section{section}
\section{section}
\bibliographystyle{alpha}
\begin{thebibliography}{Smi19}
\bibitem[Smi19]{ref1}
John Smith.
\newblock Citing in red.
\newblock {\em Journal of Hyperlink Colors}, 2019.
\end{thebibliography}
\end{document}