Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LaTeX changes colour of in-text citing with hyperref package and natbib

Tags:

latex

hyperref

I am using the natbib and hyperref packages in my LaTeX document and would like to change the colour of the box around the hyper-referenced citations from the baseline green to a more muted colour (violet or navy blue). However, in using the suggested code to do this, I cannot get the citation link colours to change. MWE:

\usepackage[usenames,dvipsnames]{color}
\usepackage[round]{natbib}
\usepackage[hyperfootnotes=false]{hyperref}
\hypersetup{
 colorlinks=false,
 citecolor=Violet,
 linkcolor=Red,
 urlcolor=Blue}

 \begin{document}

 \bibliographystyle{apsr}
 \bibliography{exp_final}
 \end{document}

However, when I compile (I compiled multiple times to make sure) my pdf file looks the same as if I had excluded the formatting in the \hypersetup (still the same green). I would also like to box the footnote citations as well.

like image 529
Thomas Avatar asked May 05 '10 03:05

Thomas


People also ask

How do you change the color of a citation in LaTeX?

\hypersetup{citecolor=yellow}\cite{eg}\hypersetup{citecolor=blue} ... should do. (+1) . optional you also could use a new command for this: preamble: \newcommand{\citeColored}[2]{\hypersetup{citecolor=#1}\cite{#2}\hypersetup{citecolor=blue}} and in text: \citeColored{yellow}{eg} .

How do you make a citation blue?

again press alt+f9 all in-text citations' color is changed to blue, cheers.

How do you cite in text in LaTeX?

Basic LaTeX comes with a few . bst style files; others can be downloaded from the web • To insert a citation in the text in the specified output style - insert the \cite command e.g. command e.g. \bibliography{references} where your reference details are stored in the file references.

How do I edit a reference in LaTeX?

You can change the reference style in LaTeX by altering the \bibliographystyle{ filename} line in your LaTeX document. Filename here should be replaced with your preferred reference style such as plain and ieeetr.


1 Answers

Actually the sample code you provided deactivate the link colorisation with the option colorlinks=false. You should use the following hyperref setup command that actually change links color.

\hypersetup{
  colorlinks,
  citecolor=Violet,
  linkcolor=Red,
  urlcolor=Blue}

To change box color around the links and citations, you have these other options :

\hypersetup{
  citebordercolor=Violet,
  filebordercolor=Red,
  linkbordercolor=Blue
}

Box appearance (specifically, width of PDF link border) is controlled by the pdfborder option. If the colorlinks option is set, boxes are deactivated (see the hyperref manual for more information).

like image 104
Lohrun Avatar answered Sep 19 '22 22:09

Lohrun