## LaTeX forum ⇒ Theses, Books, Title pages ⇒ The Legrand Orange Book: changing URL colors to ocre Topic is solved

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
kinseikun
Posts: 9
Joined: Mon Feb 05, 2018 5:11 am

### The Legrand Orange Book: changing URL colors to ocre

Hello,

I would not say I am well versed in LaTeX, but I am using the The Legrand Orange Book template to create a textbook.

I have noticed that when I use /href, url links remain black. If I change the structure package for hypersetup from colorlinks=false to true, it makes all links red and messes up the nice chapters in ocre and sections in black in the unit header mini table of contents and makes them all red too. I want to keep the ocre color since it's also our school color!

I appreciate any help. Thanks. (2 more questions to come!)

Tags:

Stefan Kottwitz
Posts: 9224
Joined: Mon Mar 10, 2008 9:44 pm
Hi,

here is a suggestion:

`\let\oldhref\href\renewcommand*{\href}[2]{\oldhref{#1}{\color{ocre}{#2}}}`

If this changes colors too much because `\href` is redefined, you could use it simpler as

`\newcommand*{\myhref}[2]{\href{#1}{\color{ocre}{#2}}}`

and later use int this way:

`\myhref{http://latex.org}{\color{red}{LaTeX Forum}}`

Stefan

kinseikun
Posts: 9
Joined: Mon Feb 05, 2018 5:11 am
Hello,

\newcommand*{\myhref}[2]{\href{#1}{\color{ocre}{#2}}} works, but now it won't compile--it gets hung up on urls with % signs in them. I believe putting a \ will break the link, am I correct? What should I do?

It works for urls that do not have %s in them :c

Stefan Kottwitz
Posts: 9224
Joined: Mon Mar 10, 2008 9:44 pm
You could "escape" the percent symbol with a backslash to prevent it from acting as commenting command, that is, write `\%`.

Stefan

kinseikun
Posts: 9
Joined: Mon Feb 05, 2018 5:11 am
Ah I see...

The issue isn't the % in the url, this url has some weird letters in it and that was causing the error:

\href{https://commons.wikimedia.org/wiki/File:Rhéa_présentant_une_pierre_emmaillotée_à_Cronos_dessin_du_bas-relief_d%27un_autel_romain.jpg} {\textbf{Chapter 2 Rhea:}}

urlcolor=blue,unicode=true]{hyperref}

but it still doesn't work for links with Frenchy things in them :c

Stefan Kottwitz
Posts: 9224
Joined: Mon Mar 10, 2008 9:44 pm
Is your document supporting Unicode? utf8 inputenc package or lualatex or xelatex?

Stefan

kinseikun
Posts: 9
Joined: Mon Feb 05, 2018 5:11 am
Yes, I have these in my structure:

\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs

I am using Overleaf to compile. I tried all of them--lualatex and pdflatex compiled, but the links with strange unicode don't work. Xelatex and latex dvipdf had errors in other areas in my document that are usually fine.

Stefan Kottwitz
Posts: 9224
Joined: Mon Mar 10, 2008 9:44 pm
Strange unicode links may be a problem... You can try this:

`\href{\detokenize{...}}{...}`

Stefan

kinseikun
Posts: 9
Joined: Mon Feb 05, 2018 5:11 am
Detokenize worked! Thanks!

I had to go and change all the %C3 things in the url to their original unicode equivalent though T_T...but now that that's finished, everything is good! Thanks!!!

I feel like I've worked on these links to images in the image credit section longer than the rest of the 250 pages