Following this thread I have tried to change the color of citation for a document using
natbib and biblatex
\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{colorlinks=true,
citecolor=red}
\usepackage[natbib=true]{biblatex}
\addbibresource{test.bib}
\newcommand\colcitep[2]{\hypersetup{citecolor=#1}\citep{#2}}
\begin{document}
The first reference should be in red \citep{dupont_2007}\par
The second reference should be in blue \colcitep{blue}{dupont_2007}\par
\hypersetup{citecolor=blue}
The third reference is OK in blue \citep{dupont_2007}\par
\printbibliography
\end{document}
test.bib
@article{dupont_2007,
title = {test title},
author = {Dupont},
date = {2007},
journaltitle = {dummy title},
shortjournal = {Short. dummy.},
volume = {64},
number = {7},
pages = {1402--1413},
}
This is run using xelatex, biber and xelatex.
Somehow the programs inserts some space before the reference
Package biblatex Warning: The following entry could not be found
(biblatex) in the database:
(biblatex) ‌​dupont_2007
(biblatex) Please verify the spelling and rerun
(biblatex) LaTeX afterwards.
This thread seems to indicate that newcommand might insert a space, but using xspace doesn't solve the issue. There seems to be some characters inserted by newcommand. What proper syntax should I use to avoid this ?

