更改 URL 超链接颜色但不更改其他超链接颜色

更改 URL 超链接颜色但不更改其他超链接颜色

基于所提问题这里,我只希望网页超链接是蓝色的,但其他超链接保持原有的颜色。

\documentclass[11pt,fleqn]{book}
\usepackage{etex}
\usepackage{filecontents}
\begin{filecontents}{chap1.bib}
 @online{pll_wikipedia,
    url={http://en.wikipedia.org/wiki/Phase-locked_loop},
    author = {Wikipedia},
    %note = {Last visited on <insert date here>},
    title = {Phase-Locked Loop},
    %month = aug,
    %year = {2006},
}
\end{filecontents}

\usepackage[svgnames]{xcolor}

\usepackage{avant}
\usepackage{mathptmx}
\usepackage{microtype} 
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{calc} 
\usepackage{textcomp} 
\usepackage{empheq}
\usepackage{graphicx}

% --------------------------------------------------------------------
% line breaks in URLs at "-"
\PassOptionsToPackage{hyphens}{url}
% --------------------------------------------------------------------

%----------------------------------------------------------------------------------------
%   HYPERLINKS IN THE DOCUMENTS
%----------------------------------------------------------------------------------------

\usepackage{hyperref}
\hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=true,breaklinks=true,urlcolor= blue,bookmarks=true,bookmarksopen=false,pdftitle={`Title},pdfauthor={Author}}
\usepackage{bookmark}
\bookmarksetup{
open,
numbered,
addtohook={%
\ifnum\bookmarkget{level}=0 % chapter
\bookmarksetup{bold}%
\fi
\ifnum\bookmarkget{level}=-1 % part
\bookmarksetup{color=ocre,bold}%
\fi
}
}

\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{chap1.bib}
 \defbibheading{bibempty}{}

\AtBeginDocument{\urlstyle{same}}%

\begin{document}
\noindent
This is just some text to show the text lines before the align environment \cite{pll_wikipedia}.

\begin{tabular}{lll}
  T1 & - & This is an explanation of equaion 1 \\
  T2 & - & This is the explanation of another equ \\
  T2T3 & - & $\dfrac{Test}{Test2}$ \\
\end{tabular}

\newpage
\section*{Bibliography}
\subsection*{Online}
\printbibliography[heading=bibempty,type=online,prefixnumbers={O}]

\end{document} 

如果我运行此代码,我的其他超链接(如\cite、、\label颜色 \tableofcontents会受到影响。有没有办法使用此设置在本地仅更改网页网址的颜色?

答案1

更新:编辑您需要添加colorlinks=truecolorlinks 在此处输入图片描述

\documentclass{article}
\usepackage{hyperref}

\hypersetup{hidelinks,
backref=true,
pagebackref=true,
hyperindex=true,
breaklinks=true,
colorlinks=true,%linkcolor=black,
urlcolor=blue,
bookmarks=true,
bookmarksopen=false,
pdftitle={Title},
pdfauthor={Author}}

\begin{document}
\tableofcontents
bla bla 

\url{http://en.wikipedia.org/wiki/Phase-locked_loop}
\section{first}\label{mm} bla bla
\section{last} bla bla \ref{mm}
\end{document}

答案2

我按照命令这里\renewcommand\UrlFont{\color{red}\rmfamily\itshape}并且能够改变 URL 字体和颜色。

相关内容