3

Building on the question asked here, I just wanted the web hyperlink to be blue but the other hyperlinks to remain the color it was.

\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} 

If I run this code, my other hyperlinks (like \cite, \label, \tableofcontents colors get affected. Is there a way to locally change just the web url color with this setup?

  • you need colorlinks=true,linkcolor=black – touhami Jul 14 '15 at 22:55
  • You hypersetup twice, one with colorlinks, once without. Get rid of the one that doesn't contain colorlinks. Btw, this reference should be of type ` @online\ rather than @misc, and howpublished = {\url{http://en.wikipedia.org/wiki/Phase-locked_loop}}, should be replaced with the simpler url={http://en.wikipedia.org/wiki/Phase-locked_loop},. – Bernard Jul 14 '15 at 23:12
  • @Bernard, thanks for your input with the @online, however, when I use @online, and I place a period after the link: url={http://en.wikipedia.org/wiki/Phase-locked_loop.},, there is a problem with the hyperlink. If I however use the @misc with howpublished = {\url{http://en.wikipedia.org/wiki/Phase-locked_loop}.}, the link works fine. The period is not part of the actual link in this latter case. – Joe Jul 20 '15 at 13:27
3

I followed the command from here: \renewcommand\UrlFont{\color{red}\rmfamily\itshape} and was able to just change the url font and color.

2

Updated: Edit You need to add colorlinks=true or colorlinks enter image description here

\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}
  • If I use the command \hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=true,breaklinks=true,urlcolor= blue,bookmarks=true,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}}, my tableofcontents, figure numbers, and \cite all also change colors. I just want the url in the bib to be blue without affecting the rest of my document. I am using the Legrand Orange book template. – Joe Jul 15 '15 at 3:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.