Theses, Books, Title pages ⇒ The Legrand Orange Book: changing URL colors to ocre
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!
Is there a way I can toggle colorlinks to true and have ocre links in later chapters without it affecting the table of contents and part headers?
I appreciate any help. Thanks. (2 more questions to come!)
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!
Is there a way I can toggle colorlinks to true and have ocre links in later chapters without it affecting the table of contents and part headers?
I appreciate any help. Thanks. (2 more questions to come!)
NEW: TikZ book now 40% off at Amazon.com for a short time.
- Stefan Kottwitz
- Site Admin
- Posts: 10320
- Joined: Mon Mar 10, 2008 9:44 pm
The Legrand Orange Book: changing URL colors to ocre
Hi,
here is a suggestion:
If this changes colors too much because
and later use int this way:
Stefan
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
LaTeX.org admin
The Legrand Orange Book: changing URL colors to ocre
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
\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
- Site Admin
- Posts: 10320
- Joined: Mon Mar 10, 2008 9:44 pm
The Legrand Orange Book: changing URL colors to ocre
You could "escape" the percent symbol with a backslash to prevent it from acting as commenting command, that is, write
Stefan
\%
.Stefan
LaTeX.org admin
The Legrand Orange Book: changing URL colors to ocre
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:}}
I added unicode to this package: \usepackage[breaklinks,colorlinks=true,
urlcolor=blue,unicode=true]{hyperref}
but it still doesn't work for links with Frenchy things in them :c
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:}}
I added unicode to this package: \usepackage[breaklinks,colorlinks=true,
urlcolor=blue,unicode=true]{hyperref}
but it still doesn't work for links with Frenchy things in them :c
- Stefan Kottwitz
- Site Admin
- Posts: 10320
- Joined: Mon Mar 10, 2008 9:44 pm
The Legrand Orange Book: changing URL colors to ocre
Is your document supporting Unicode? utf8 inputenc package or lualatex or xelatex?
Stefan
Stefan
LaTeX.org admin
The Legrand Orange Book: changing URL colors to ocre
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.
\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
- Site Admin
- Posts: 10320
- Joined: Mon Mar 10, 2008 9:44 pm
The Legrand Orange Book: changing URL colors to ocre
Strange unicode links may be a problem... You can try this:
Stefan
\href{\detokenize{...}}{...}
Stefan
LaTeX.org admin
The Legrand Orange Book: changing URL colors to ocre
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
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
