更改超链接交叉引用中使用的颜色

更改超链接交叉引用中使用的颜色

这是我的文档的 Latex 代码的简化示例。我想更改不同链接的颜色(通过 \ref 和 \hyperlink 创建)。

具体来说,我想要

-方程式:黑色(不是蓝色)

- 部分:黑色(不是蓝色)

-作者:蓝色,但比我现在的要浅

-脚注:红色(不是黑色)。(此外,脚注的链接似乎不起作用。我认为这是因为 footmisc 的多个选项。有什么办法可以解决这个问题吗?)

\documentclass[10 pt,a4paper,oneside,openany, notitlepage]{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{amsmath, amssymb, graphics}
\marginparwidth 0pt
\oddsidemargin 0pt
\evensidemargin 0pt
\marginparsep 0pt
\linespread{1.5}
\topmargin 0pt
\textwidth 6.5in
\textheight 8.5 in 
\usepackage[colorlinks = true,
            linkcolor = blue,
            urlcolor  = blue,
            citecolor = blue,
            anchorcolor = blue]{hyperref}               
\usepackage[multiple]{footmisc}


\begin{document}
\section{Section 1}
\label{sec1}
This main result\footnote{There are other minor results.} of \hyperlink{Tom}{Tom (2017)} is summarised by equation (\ref{main}). Similar arguments are discussed in Section \ref{sec2}.
\begin{equation}
\label{main}
A=B
\end{equation}

\section{Section 2}
\label{sec2}

\newpage
\begin{center}
\section*{References}
\end{center}

\begin{description}
\item \hypertarget{Tom}{ } Tom, 2017, Journal. 
\end{description}


\end{document}

答案1

我建议你利用Marco Daniel 的回答定义一个名为“footnotecolor”的 hyperref 参数。我进一步建议您使用包\cite的机制natbib来创建引文标注。(更好的是,学习如何使用 BibTeX——让 BibTeX 和 LaTeX 同时创建格式化的参考书目所有引文标注。)

在此处输入图片描述

\documentclass[10pt,a4paper,oneside,openany,notitlepage]{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{amsmath,amssymb,graphics}
\usepackage[multiple]{footmisc}
\usepackage[textwidth=6.5in,textheight=8.5in]{geometry}
\usepackage[authoryear,round]{natbib}

\usepackage{hyperref}
%% The following code is from a posting by Marco Daniel;
%% see https://tex.stackexchange.com/a/117959/5001.
\makeatletter
\def\@footnotecolor{red} % default color to use: 'red'
\define@key{Hyp}{footnotecolor}{%
 \HyColor@HyperrefColor{#1}\@footnotecolor%
}
\def\@footnotemark{%
    \leavevmode
    \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
    \stepcounter{Hfootnote}%
    \global\let\Hy@saved@currentHref\@currentHref
    \hyper@makecurrent{Hfootnote}%
    \global\let\Hy@footnote@currentHref\@currentHref
    \global\let\@currentHref\Hy@saved@currentHref
    \hyper@linkstart{footnote}{\Hy@footnote@currentHref}%
    \@makefnmark
    \hyper@linkend
    \ifhmode\spacefactor\@x@sf\fi
    \relax
  }%
\makeatother

\hypersetup{colorlinks = true,
            allcolors  = black, % default color
            citecolor  = blue,
            footnotecolor = red}        

\begin{document}
\section{First} \label{sec1}

This main result\footnote{There are other, minor results.} of \citet{Tom} is summarised by equation \eqref{main}. Similar arguments are discussed in Section~\ref{sec2}.

\begin{equation} \label{main} 
A=B 
\end{equation}

\section{Second} \label{sec2}

\begin{thebibliography}{9}

\bibitem[Tom(2017)]{Tom} Tom, 2017, Journal. 

\end{thebibliography}

\end{document}

相关内容