# Bibliography: change author color

I'm writing because I wasn't able to find a solution nor in Google nor here. My question is similar to this one, but that hasn't a solution yet. Is similar to this one too, but it uses beamer and I'm not.

My question is: how can I change the color of the author (only the author) item in my bibliography, which is formatted as follows:

\usepackage[backend=bibtex,style=authoryear,natbib=true,dashed=false,language=italian]{biblatex}

This works fine, but in the Bibliography at the end of the document, I would have the author colored. I mean, only the author, nothing more in the document, which should remain the same.

I tried by adding \textcolor to the item in the bibliography file:

@article{addicott2006networks,
title={Networks, organizational learning and knowledge management: NHS cancer networks},
author={\textcolor{red}{Addicott, Rachael} and McGivern, Gerry and Ferlie, Ewan},
journal={Public Money and Management},
volume={26},
number={2},
pages={87--94},
year={2006},
publisher={Taylor & Francis},
langid={italian},
}


The result was perfect for the bibliography, but it modifies also the color of the reference in the text, as in the following images:

Does anyone know how to just color the author in the bibliography and leave unaltered in the text?

(I know I'm not providing any MWE, honestly I don't think is necessary in this case. But if needed I will post it.)

Thank you for your time, R.

UPDATE: sorry guys, here the MWE for what I'm trying to figure out:

\documentclass[12pt]{article}
\usepackage{color}
\usepackage[backend=bibtex,style=authoryear,natbib=true,dashed=false,language=italian]{biblatex}

\begin{document}

Reference I don't want to be coloured \citep{addicott2006networks}

\printbibliography[title={Bibliografia}]

\end{document}

title={Networks, organizational learning and knowledge management: NHS cancer networks},
author={\textcolor{red}{Addicott, Rachael} and McGivern, Gerry and Ferlie, Ewan},
journal={Public Money and Management},
volume={26},
number={2},
pages={87--94},
year={2006},
publisher={Taylor \& Francis},
langid={italian},
}

• Not necessary in what sense? You mean that if somebody really wants to help you, they might be able to figure out what you're doing? Of course. But (1) somebody might be willing to help, but not that enthusiastic, and (2) they might not figure it out, guess incorrectly and just waste their time. Better chance of being useful if they spend their efforts helping somebody who really wants the help. (I figure you are mildly interested in an answer, but not especially bothered if you don't get one.) – cfr Apr 11 '17 at 0:57
• Can you be a bit more specific about what you want? Your title and the wording in your question suggests to me (maybe wrongly) that you want to colour all authors. But in your screenshot you explicitly colour only one author in the list. – moewe Apr 11 '17 at 6:01
• A MWE is always necessary! For example, your publisher={Taylor & Francis} surely is an error, it should be publisher={Taylor \& Francis}. – CarLaTeX Apr 11 '17 at 6:22
• Regarding the need for an MWE: Some questions are entirely clear and can be answered without an MWE. Other questions need an MWE because they are about specific behaviour caused by a particular piece of code. Sometimes people think their questions don't need an MWE, yet it is needed in order to assess the situation. There are several ways to achieve different things and it is not always entirely clear which was used without an MWE. But even questions that need no MWE at all can still benefit from one. It allows helpers to directly start working on the solution ... – moewe Apr 11 '17 at 8:17
• ... instead of having to spend time building the environment in which it should be used. Plus, this allows those answering questions to test their solution in the exact environment they are going to be used. The time needed to provide a good code environment is much less for those asking than those answering. Take your question as an example, you have given us quite some snippets of code. It would take you just a few more minutes (if at all) to complete it to an MWE that resembles your document. But for us it might be more complicated. – moewe Apr 11 '17 at 8:22

Assuming you want 'Last, First' names where the comma within the name is to be coloured yet the delimiter between names (either a comma or 'and') is not to be coloured, use

\documentclass{article}
\usepackage{xcolor}
\usepackage[backend=bibtex,style=authoryear,natbib=true,dashed=false,language=italian]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
title={Networks, organizational learning and knowledge management: NHS cancer networks},
author={Addicott, Rachael and McGivern, Gerry and Ferlie, Ewan},
journal={Public Money and Management},
volume={26},
number={2},
pages={87-94},
year={2006},
langid={italian},
}
\end{filecontents}

\DeclareNameFormat{colour-family-given}{%
\ifgiveninits
{\usebibmacro{name:colour:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:colour:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
\usebibmacro{name:andothers}}

\newbibmacro*{name:colour:family-given}[4]{%
\ifuseprefix
{\usebibmacro{name:delim}{#3#1}%
\usebibmacro{name:hook}{#3#1}%
\textcolor{red}{%
\ifdefvoid{#3}{}{%
\ifcapital
{\mkbibnameprefix{\MakeCapital{#3}}\isdot}
{\mkbibnameprefix{#3}\isdot}%
\ifprefchar{}{\bibnamedelimc}}%
\mkbibnamefamily{#1}\isdot
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}%
\ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{#2}\isdot}}}
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
\textcolor{red}{%
\mkbibnamefamily{#1}\isdot
\ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}%
\ifboolexpe{%
test {\ifdefvoid{#2}}
and
test {\ifdefvoid{#3}}}
{}
{\revsdnamepunct}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}\isdot}%
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}}}}

\DeclareNameAlias{sortname}{colour-family-given}

\pagestyle{empty}
\begin{document}
\printbibliography
\end{document}


sortname is the name format used in author-year/author-title-like styles for the labelname.

• OOOH yes! It works like a charm @moewe! Thank you! One more question related to your code, please: if I understood well, the code assign a color to the name and a color to the family name, isn't it? One of the most difficult things to understand for me is the test and test part. – user51937 Apr 11 '17 at 8:56
• @user51937 The code is a copy of the original definitions from biblatex.def with \textcolor{red} added in the right places. It uses the same colour for all name parts. It was just necessary to define two macros due to the way the macros work. – moewe Apr 11 '17 at 8:59

Assuming you want just the first author coloured, then you can do it by creating a new name format based off family-given/given-family and then aliasing the author name format to it. You could create a similar name format alias for editor if you needed it. Something like this:

\documentclass{article}
\usepackage{xcolor}
\usepackage[backend=bibtex,style=authoryear,natbib=true,dashed=false,language=italian]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
title={Networks, organizational learning and knowledge management: NHS cancer networks},
author={Addicott, Rachael and McGivern, Gerry and Ferlie, Ewan},
journal={Public Money and Management},
volume={26},
number={2},
pages={87-94},
year={2006},
langid={italian},
}
\end{filecontents}
\DeclareNameFormat{coloured-family-given/given-family}{%
\ifnumequal{\value{listcount}}{1}
{\textcolor{red}{%
\ifgiveninits
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
\ifboolexpe{%
test {\ifdefvoid\namepartgiven}
and
test {\ifdefvoid\namepartprefix}}
{}
{\usebibmacro{name:revsdelim}}}}
{\ifgiveninits
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}%
\usebibmacro{name:andothers}}
\DeclareNameAlias{author}{coloured-family-given/given-family}
\pagestyle{empty}
\begin{document}

• Note that with standard author-year/author-title styles you can use sortname to access the labelname format in bibliographies. This means you don't have to redefine author, editor and translator. – moewe Apr 11 '17 at 9:08
• @user51937 Sorry, I might have been a bit unclear. You could just do \DeclareNameAlias{sortname}{coloured-family-given/given-family}, and would not have to alias author, editor and translator (as was done for author and mentioned for editor).# – moewe Apr 11 '17 at 12:33