使用 biblatex-gost 包在参考书目中突出显示作者

使用 biblatex-gost 包在参考书目中突出显示作者

当尝试使用解决方案突出显示作者时使用 biblatex 突出显示参考书目中的作者,并允许使用参考书目样式对其进行格式化事实证明,它完美地与默认样式配合使用,但与biblatex-gost某些样式配合使用时就无法正常工作(好吧,至少与gost-numeric我需要的样式配合使用时无法正常工作,其他样式尚未测试)。应该进行哪些更改才能使其正常工作?

\documentclass{article}
\usepackage[backend=biber,style=gost-numeric]{biblatex}% If one deletes "gost-" all becomes OK

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}

  @incollection{Silva:2014a,
  title={Radio Resource Management for Device-to-Device Communications in Long Term Evolution Networks},
  author={Carlos F. M. Silva and Silva, Jr., Jos\'{e} Mairton B. and Tarcisio F. Maciel},
  booktitle={Resource Allocation and {MIMO} for {4G} and Beyond},
  publisher={Springer Science+Business Media},
  year=2014,
  address={New York, USA},
  editor={Francisco Rodrigo Porto Cavalcanti},
  pages={105-156},
  doi={10.1007/978-1-4614-8057-0_3},
  isbn={978-1-4614-8056-3},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\usepackage{xpatch}% or use https://tex.stackexchange.com/a/40705

\newbibmacro*{name:bold}[2]{%
  \def\do##1{\iffieldequalstr{hash}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}%
}

\newcommand*{\boldnames}{}

\xpretobibmacro{name:last}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:first-last}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:last-first}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}

\xapptobibmacro{name:last}{\endgroup}{}{}
\xapptobibmacro{name:first-last}{\endgroup}{}{}
\xapptobibmacro{name:last-first}{\endgroup}{}{}
\xapptobibmacro{name:delim}{\endgroup}{}{}

\renewcommand*{\boldnames}{}
\forcsvlist{\listadd\boldnames}
  {{5e1df516fe8816ee66169b8616522816}}

\begin{document}
\fullcite{Silva:2014a}

\printbibliography
\end{document}

答案1

此答案已更新,以适用于较新版本的biblatex-gost。 请参阅旧版本的编辑历史。

biblatex-gost为名为 的作者定义了自己的姓名格式headingname:family-given,因此您需要修补此宏。

平均能量损失

\documentclass{article}
\usepackage[backend=biber,style=gost-numeric]{biblatex}
\usepackage{xpatch}

\newcommand*{\boldnames}{}

\newcommand*{\doboldhashes}[1]{%
  \iffieldequalstr{hash}{#1}
    {\bfseries\listbreak}
    {}}%

\newbibmacro*{name:bold}{%
  \forlistloop{\doboldhashes}{\boldnames}%
}

\xpretobibmacro{headingname:family-given}{\begingroup\usebibmacro{name:bold}}{}{}
\xapptobibmacro{headingname:family-given}{\endgroup}{}{}

\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}
\xapptobibmacro{name:delim}{\endgroup}{}{}

\renewcommand*{\boldnames}{}
\forcsvlist{\listadd\boldnames}
  {{5e1df516fe8816ee66169b8616522816}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{Silva:2014a,
  title={Radio Resource Management for Device-to-Device Communications in Long Term Evolution Networks},
  author={Carlos F. M. Silva and Silva, Jr., Jos\'{e} Mairton B. and Tarcisio F. Maciel},
  booktitle={Resource Allocation and {MIMO} for {4G} and Beyond},
  publisher={Springer Science+Business Media},
  year=2014,
  address={New York, USA},
  editor={Francisco Rodrigo Porto Cavalcanti},
  pages={105-156},
  doi={10.1007/978-1-4614-8057-0_3},
  isbn={978-1-4614-8056-3},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\fullcite{Silva:2014a}

\printbibliography
\end{document}

答案2

为了完成上述答案:name:delim会影响名称前的分隔符,因此根据所需的效果,可能需要对其进行修补。

如果没有修补,则粗体名称前的分隔符将为粗体;如果用 修补\normalfont,则它将是常规的。

相关内容