我是新來的,所以請耐心等待。我想做姓的僅限第一作者在參考書目中,即在MWE中,我希望參考書目中的“Fox”(而不是引文)是粗體的。
微量元素:
\documentclass[a4paper,twoside,hidelinks]{article}
\usepackage[backend=biber,
natbib=true,
uniquename=false,
uniquelist=false,
firstinits=true,
style=authoryear,
sorting=nyt,
maxcitenames=2,
minbibnames=1,
maxbibnames=100,
block=none]{biblatex}
\bibliography{sample.bib}
\begin{document}
Here is some sample text \parencite{Fox2011}.
\printbibliography
\end{document}
\RequirePackage{filecontents}
\begin{filecontents}{sample.bib}
@ARTICLE{Fox2011,
author = {Peter Fox and Richard Rabbit and Franc Bird},
title = {Animals are the better humans},
journal = {Horse and Hound},
year = {2011},
volume = {10},
pages = {11--15}
}
\end{filecontents}
答案1
我們重新定義一個bibmacro
。更改實際上非常小:插入少量\mkbibbold
.
\renewbibmacro*{name:last-first}[4]{%
\ifuseprefix
{\usebibmacro{name:delim}{#3#1}%
\usebibmacro{name:hook}{#3#1}%
\ifblank{#3}{}{%
\ifcapital
{\mkbibbold{\mkbibnameprefix{\MakeCapital{#3}}\isdot}}
{\mkbibbold{\mkbibnameprefix{#3}\isdot}}%
\ifpunctmark{'}{}{\bibnamedelimc}}%
\mkbibbold{\mkbibnamelast{#1}\isdot}%
\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
\ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{#2}\isdot}}
{\usebibmacro{name:delim}{#1}%
\usebibmacro{name:hook}{#1}%
\mkbibbold{\mkbibnamelast{#1}\isdot}%
\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
\ifblank{#2#3}{}{\revsdnamepunct}%
\ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{#2}\isdot}%
\ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}}}
答案2
我認為最好使用專用的名稱格式來完成。
\mkbibnamefamily
這個想法是重新定義只列印名字的姓氏的宏,然後恢復它。
預設authoryear
使用family-given/given-family
,所以我們定義family-given/given-family-bf
。
\DeclareNameFormat{family-given/given-family}{%
\ifnumequal{\value{listcount}}{1}
{\renewcommand*{\mkbibnamefamily}[1]{\mkbibbold{##1}}%
\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}}}
{\renewcommand*{\mkbibnamefamily}[1]{##1}%
\ifgiveninits
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}%
\usebibmacro{name:andothers}}
如果您喜歡中的所有名稱family-given
\DeclareNameFormat{family-given-fb}{%
\ifnumequal{\value{listcount}}{1}
{\renewcommand*{\mkbibnamefamily}[1]{\mkbibbold{##1}}}
{\renewcommand*{\mkbibnamefamily}[1]{##1}}%
\ifgiveninits
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
\usebibmacro{name:andothers}}
或者given-family
\DeclareNameFormat{given-family-fb}{%
\ifnumequal{\value{listcount}}{1}
{\renewcommand*{\mkbibnamefamily}[1]{\mkbibbold{##1}}}
{\renewcommand*{\mkbibnamefamily}[1]{##1}}%
\ifgiveninits
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
\usebibmacro{name:andothers}}
然後使用上述格式之一 via \DeclareNameAlias{sortname}{format}
,例如
\DeclareNameAlias{sortname}{family-given-fb}
微量元素
\documentclass{article}
\usepackage[backend=biber, style=authoryear]{biblatex}
\DeclareNameAlias{sortname}{family-given-fb}
\DeclareNameFormat{family-given-fb}{%
\ifnumequal{\value{listcount}}{1}
{\renewcommand*{\mkbibnamefamily}[1]{\mkbibbold{##1}}}
{\renewcommand*{\mkbibnamefamily}[1]{##1}}%
\ifgiveninits
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
\usebibmacro{name:andothers}}
\bibliography{biblatex-examples.bib}
\begin{document}
Here is some sample text \parencite{baez/article}.
\printbibliography
\end{document}
為>= 3.3編輯biblatex
,舊版本可以在編輯歷史中找到。順便說一句,在未來版本(即 > 3.11)中不需要恢復舊的定義,\mkbibnamefamily
因為名稱應該分組https://github.com/plk/biblatex/pull/731。