# How to change color to black with \citep

Edited Version

I searched a lot here for a solution to my problem but couldn't find, please be patient with me.

    \usepackage[backend=bibtex,style=authoryear,natbib=true,maxbibnames=2]{biblatex}

\DeclareCiteCommand{\citep}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}


When I use \citep to show two authors name and year, I got what I want but in pink color.

I would like to change this color to black with keeping the same format e.g:

(Autor1 and Autho2, 2019)

Any help will be appreciated.

• Welcome to TeX.SX! The colour probably is coming from hyperref. Try using \hypersetup{hidelinks} after loading hyperref. – Phelype Oleinik Jun 19 at 15:31
• Then please, make a short compilable code (a minimal working example (MWE)) that reproduces this issue so that we can find out where does the colour com from. – Phelype Oleinik Jun 19 at 15:41
• @PhelypeOleinik +1,Thanks a lot, I used your helpful comment to search and edit my cls file and I change the cite color from magenta to black – Moh Jun 19 at 15:49
• The problem is that that template loads hyperref at the \begin{document}, so whatever changes you do before that can be overwritten. If you do \hypersetup{hidelinks} after the \begin{document} it will work (it will hide all links; if you want just citations, then \hypersetup{citecolor=black}). – Phelype Oleinik Jun 19 at 15:54
• If it is not too late you may want to consider dropping the template you are using and starting from a more minimal setup instead. That way you know what each bit of code you add to your document does and don't start with a hugely complicated code base. See also github.com/johannesbottcher/templateConfusion/blob/master/… (You can also find many questions about your particular template on this site) – moewe Jun 19 at 16:05

Use the following setting

 \hypersetup{citecolor=black}


Working example:

\documentclass{article}

\usepackage[backend=bibtex,style=authoryear,natbib=true,maxbibnames=2]{biblatex}

\DeclareCiteCommand{\citep}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}

\hypersetup{citecolor=black}

\begin{document}

\citep{knuth}

\printbibliography
\end{document}


• @Moh Post a compilable code - works in my example – harryparp Jun 19 at 15:40
• +1 thanks a lot, I used your answer to search and edit my cls file and I change the cite color from magneta to black. – Moh Jun 19 at 15:48
• @Moh Do not change the class file. See the license. You can make any changes in the preamble, respectively right after \begin{document}. Or look at the \AtBeginDocument{ in the template, where hyperref changes are set up. Or don't load hyperref at all by uncommenting the nohyperref option. – Johannes_B Jun 20 at 4:48