Generalhyperref/hyperlink: can I change the link text colour class

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
rankinjo
Posts: 4
Joined: Mon Feb 25, 2008 12:45 am

hyperref/hyperlink: can I change the link text colour class

Post by rankinjo »

I have a local command \citesic that provides a link from a citation to its labelled reference, defined as follows:

Code: Select all

\newcommand\citesic[2]{\hyperlink{#2}{#1}}
#2 is the label and #1 is the link text.

The problem is that if we configure hyperref so that colorlinks=true, these links come out in the linkcolor, whereas we want them to come out in the citecolor. Is there a way we can define the \citesic command so that it tells hyperref to treat this kind of link as if it falls in the cite colour class, rather than the link colour class? We want the links to continue to be black if colorlinks=false and we want to be able to change the default colour using the standard citecolor=<name> hyperref option.

We do this because the xml-based source already knows the link text to use for a given labelled reference, so when we transform the xml to LaTeX for processing, we don't need to use a package such as natbib.

Any help will be appreciated.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply