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

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

Post Reply