I know that I can do this:
--------------------------------------------------------------------
\hypersetup{
colorlinks=false, % false: boxed links; true: colored links
linkcolor=red, % color of internal links
citecolor=green, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links
}
--------------------------------------------------------------------
to make sure that my hyperlinks don't change color.
But what if I want some of my links to change color and some not to?
General ⇒ changing colour of links
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
changing colour of links
What do you exactly mean with that? Be more precise. When posting the same request also in another forum, please mention this [1]. It prevents users from wasting time in case that a solution is given already elsewhere.juliette wrote:[…] But what if I want some of my links to change color and some not to?
[1] CQF.info :: View topic - Changing color of links
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
changing colour of links
I apologize for not mentioning that I posted the same question elsewhere. I was unaware that the two forums were related.
With regards to being more specific:
I have various links to external URLs on the web from my document which I created in LaTeX using \href{}{}.
When I apply this command, the argument of the second {} is displayed in a navy blue colour in the resulting PDF file.
However, for some hyperlinks, I want the colour to remain black and still link to a URL.
And for others, i DO indeed want the link to become navy blue.
Is this possible?
And I posted this response on CQF as well.
With regards to being more specific:
I have various links to external URLs on the web from my document which I created in LaTeX using \href{}{}.
When I apply this command, the argument of the second {} is displayed in a navy blue colour in the resulting PDF file.
However, for some hyperlinks, I want the colour to remain black and still link to a URL.
And for others, i DO indeed want the link to become navy blue.
Is this possible?
And I posted this response on CQF as well.
Re: changing colour of links
Here's the answer. It was posted by user gmedina on CQF.
\documentclass[10pt]{article}
\usepackage{hyperref}
\hypersetup{
colorlinks=true, % false: boxed links; true: colored links
linkcolor=red, % color of internal links
citecolor=green, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links
}
\newcommand*{\myhref}[2]{%
\hypersetup{urlcolor=black}\href{#1}{#2}\hypersetup{urlcolor=cyan}}
\begin{document}
\href{http://www.cqf.info}{CQF.info}
\myhref{http://www.cqf.info}{CQF.info}
\href{http://www.cqf.info}{CQF.info}
\end{document}
\documentclass[10pt]{article}
\usepackage{hyperref}
\hypersetup{
colorlinks=true, % false: boxed links; true: colored links
linkcolor=red, % color of internal links
citecolor=green, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links
}
\newcommand*{\myhref}[2]{%
\hypersetup{urlcolor=black}\href{#1}{#2}\hypersetup{urlcolor=cyan}}
\begin{document}
\href{http://www.cqf.info}{CQF.info}
\myhref{http://www.cqf.info}{CQF.info}
\href{http://www.cqf.info}{CQF.info}
\end{document}