Biblatex 参考文献の第一著者の姓を太字にする

Biblatex 参考文献の第一著者の姓を太字にする

私はここに来たばかりなので、どうかご容赦ください。苗字第一著者のみ参考文献の太字、つまり、MWE では、参考文献の「Fox」のみ(引用ではなく)を太字にしたいのです。

MWE:

\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

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}}

次に、上記の形式のいずれかを 経由で使用します\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以降用に編集されました。古いバージョンは編集履歴で確認できます。ちなみに、将来のバージョン(3.11以降)では、名前がグループ化されるためbiblatex、古い定義を復元する必要はありません。\mkbibnamefamilyhttps://github.com/plk/biblatex/pull/731

関連情報