Monday, November 26, 2012

changing colour of citations in-text

So I had a figure where a certain colour represented data from a certain citation and I didn't want to put the name beside every single datapoint - it would be better in the figure legend. But I came across an issue - \textcolor{} just changes the text colour but the not the colour of the citation itself if you're using hyperref, so for instance:
shows up as
Smith (2011) 
which is not what I want. The easiest way to do it with hyperref is by using the citecolor of hypersetup:
shows up as:
Smith (2011) 
obviously, this is cumbersome, and that brackets are still black and you still need to revert the link colour back to black, so just create a newcommand:
This generates a citation in-text and then converts the colour set-up back to black each time. As the brackets would still be black, you have to use the textcolor command to change them as well.
So now I can just use:
to generate
Smith (2011) 

No comments:

Post a Comment