0

This post shows how to color within-document links, and I am happy to have this in a document I am writing. My main motivation was to put long sequences of references in one color so my eyes know where the next sentence starts. Now, if I want to skip over a list of twelve author-year references, it is easy. However, this also puts other references in that color. I am okay with having other links within my PDF output so that I can go up a few pages back to an equation, for instance, but I do not want \ref to give text in color.

\usepackage[colorlinks=true,linkcolor=blue]{hyperref}%

How can I modify the linked syntax so that bibliography citations appear in color but only the bibliography citations? The link mentions using citecolor = blue, but that still leaves colors in my \ref references.

EDIT

Amazing: if I change the color, the old color remains for my \ref references.

Dave
  • 113

1 Answers1

0

enter image description here

To color only certain citation labels, you need to redefine citecolor in a local group

\documentclass{book}

\usepackage[x11names]{xcolor}

\usepackage{hyperref} \hypersetup{citecolor=DodgerBlue3, citebordercolor=DodgerBlue3, colorlinks=true}

\usepackage[style=alphabetic]{biblatex} \addbibresource{biblatex-examples.bib}

\begin{document}

{ \hypersetup{citecolor=SlateBlue2, citebordercolor=SlateBlue2, colorlinks=true} \cite{westfahl:space,set,stdmodel,aksin,angenendt,baez/article,bertram,doody,matuz:doody,gillies,glashow,herrmann,kastenholz,murray} }

\cite{westfahl:space,set,stdmodel,aksin,angenendt,baez/article,bertram,doody,matuz:doody,gillies,glashow,herrmann,kastenholz,murray}

\end{document}

  • Thanks for replying! I copied that verbatim into TeXstudio and got the following in all black: [westfahl:space; set; stdmodel; aksin; angenendt; baez/article; bertram; doody; matuz:doody; gillies; glashow; herrmann; kastenholz; murray] [westfahl:space; set; stdmodel; aksin; angenendt; baez/article; bertram; doody; matuz:doody; gillies; glashow; herrmann; kastenholz; murray]. What's going on? – Dave Mar 03 '23 at 00:20
  • Does TeXstudio show any errors/warnings (despite the warning in line 15)? Is your bib-file accessible for your document? Did you compile often enough such that the .aux file is written correctly? I get the expected output in Overleaf – Οὖτις Mar 03 '23 at 09:37
  • @Dave. You must get biblatex-examples.bib from the following directory %AppData%\Local\Programs\MiKTeX\bibtex\bib\biblatex – Al-Motasem Aldaoudeyeh Mar 03 '23 at 11:20
  • I tried it with my own references, and they still show up in black. Thoughts? – Dave Mar 03 '23 at 14:15