General ⇒ changing colour of links
changing colour of links
--------------------------------------------------------------------
\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?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- 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¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
changing colour of links
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
\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}