我写信是因为我无法在 Google 或这里找到解决方案。我的问题类似于这个,但还没有解决方案。类似于这个也是,但是它使用投影仪而我没有。
我的问题是:如何改变作者的颜色(仅限作者) 项目,其格式如下:
\usepackage[backend=bibtex,style=authoryear,natbib=true,dashed=false,language=italian]{biblatex}
这很好,但在文档末尾的参考书目中,我会将作者涂成彩色。我的意思是,只有作者,文档中没有其他内容,应该保持不变。
我尝试\textcolor
在参考书目文件中添加该项目:
@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},
}
这对于参考书目来说是完美的,但它还修改了文本中参考的颜色,如下图所示:
有人知道怎么做只需在参考书目中标出作者的颜色和保持不变在文中?
(我知道我没有提供任何 MWE,老实说,我认为在这种情况下没有必要。但如果需要,我会发布它。)
感谢您抽出时间,R。
更新:对不起伙计们,这是我试图弄清楚的 MWE:
\documentclass[12pt]{article}
\usepackage{color}
\usepackage[backend=bibtex,style=authoryear,natbib=true,dashed=false,language=italian]{biblatex}
\addbibresource{biblio.bib}
\begin{document}
Reference I don't want to be coloured \citep{addicott2006networks}
\printbibliography[title={Bibliografia}]
\end{document}
@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},
}
答案1
假设您想要“姓,名”的名称,其中名称内的逗号需要着色,但名称之间的分隔符(逗号或“and”)不需要着色,请使用
\documentclass{article}
\usepackage{xcolor}
\usepackage[backend=bibtex,style=authoryear,natbib=true,dashed=false,language=italian]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{addicott2006networks,
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}
\addbibresource{\jobname.bib}
\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}
\autocite{addicott2006networks}
\printbibliography
\end{document}
sortname
是作者年份/作者标题类样式中标签名称所使用的名称格式。
答案2
family-given/given-family
假设您只想为第一作者着色,那么您可以通过创建一个基于此的新名称格式,然后将author
名称格式别名为该格式来实现。editor
如果需要,您可以为它创建一个类似的名称格式别名。如下所示:
\documentclass{article}
\usepackage{xcolor}
\usepackage[backend=bibtex,style=authoryear,natbib=true,dashed=false,language=italian]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{addicott2006networks,
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}
\addbibresource{\jobname.bib}
\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}
\autocite{addicott2006networks}
\printbibliography
\end{document}