加粗作者姓名

加粗作者姓名

我一直在使用 snipet 来使参考书目中的特定作者姓名加粗(请参阅\newcommand下文)。它工作得很好,但它改变了作者的默认风格(我更喜欢默认风格,见下图)。我的问题是,这个命令相当复杂,我真的不明白那里发生了什么。如果有人能给我解释一下,我将不胜感激如何将格式改回首选格式,然后为什么这样,我就能真正理解代码了(或者有没有比下面的代码更简单的方法来实现这种加粗?)。

更新

添加了额外的作者,请注意,只有选定的作者(Strombom)被突出显示

移动网络

\documentclass{article}
\usepackage[defernumbers=true,sorting=none,backend=biber,maxnames=10]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}

\newcommand{\makeauthorbold}[1]{%
\DeclareNameFormat{author}{%
  \edef\tempname{{#1}}%
  \ifnumequal{\value{listcount}}{1}
    {\ifnumequal{\value{liststop}}{1}
      {\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4\addcomma\isdot}}{##1\addcomma\addspace ##4\addcomma\isdot}}
      {\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4}}{##1\addcomma\addspace ##4}}}
    {\ifnumless{\value{listcount}}{\value{liststop}}
      {\expandafter\ifstrequal\tempname{##1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4}}{\addcomma\addspace ##1\addcomma\addspace ##4}}
      {\expandafter\ifstrequal\tempname{##1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}%
    }%
}%
}

\begin{filecontents}{\jobname.bib}
@article{Perunov,
author = {Perunov, Nikolay and Marsland, Robert A and England, Jeremy L},
doi = {10.1103/PhysRevX.6.021036},
keywords = {Biological Physics,Complex Systems,Statistical Physics,Subject Areas},
mendeley-groups = {dissertation},
title = {{Statistical Physics of Adaptation}},
url = {https://journals.aps.org/prx/pdf/10.1103/PhysRevX.6.021036}
}

@article{Strombom2011,
author = {Strombom, Daniel and Random, Author2 and Familyname, Givenname},
doi = {10.1016/j.jtbi.2011.05.019},
journal = {Journal of Theoretical Biology},
mendeley-groups = {dissertation},
month = {aug},
number = {1},
pages = {145--151},
title = {{Collective motion from local attraction}},
url = {http://linkinghub.elsevier.com/retrieve/pii/S002251931100261X},
volume = {283},
year = {2011},
keywords = "nourl"
}

@article{Gell-Mann1995,
author = {Gell-Mann, Murray and Random, Author2 and Familyname, Givenname},
doi = {10.1002/cplx.6130010105},
journal = {Complexity},
mendeley-groups = {dissertation},
month = {sep},
number = {1},
pages = {16--19},
publisher = {Wiley Subscription Services, Inc., A Wiley Company},
title = {{What is complexity?}},
url = {http://doi.wiley.com/10.1002/cplx.6130010105},
volume = {1},
year = {1995},
keywords = "nourl"
}
\end{filecontents}

\begin{document}

\nocite{*}
{
\makeauthorbold{Strombom}
\printbibliography[title={bad author},heading=subbibliography,keyword=nourl]
}


\printbibliography[title={good author},heading=subbibliography,notkeyword=nourl]
\end{document}

在此处输入图片描述

编译

lualatex mweb.tex && biber mweb  && lualatex mweb.tex

我使用上述命令编译了它。

$ lualatex --v
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238)

答案1

根据biblatex文档,处理此问题的方法应该是作者注释。如果这不仅适用于一个子书目,请将\renewcommands 移至序言。

\documentclass{article}
\usepackage[defernumbers=true,sorting=none,backend=biber,maxnames=10]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Perunov,
author = {Perunov, Nikolay and Marsland, Robert A and England, Jeremy L},
doi = {10.1103/PhysRevX.6.021036},
keywords = {Biological Physics,Complex Systems,Statistical Physics,Subject Areas},
mendeley-groups = {dissertation},
title = {{Statistical Physics of Adaptation}},
url = {https://journals.aps.org/prx/pdf/10.1103/PhysRevX.6.021036}
}

@article{Strombom2011,
author = {Strombom, Daniel and Einstein, Albert},
doi = {10.1016/j.jtbi.2011.05.019},
journal = {Journal of Theoretical Biology},
mendeley-groups = {dissertation},
month = {aug},
number = {1},
pages = {145--151},
title = {{Collective motion from local attraction}},
url = {http://linkinghub.elsevier.com/retrieve/pii/S002251931100261X},
volume = {283},
year = {2011},
keywords = "nourl",
AUTHOR+an = {1=corresponding},
}

@article{Gell-Mann1995,
author = {Gell-Mann, Murray},
doi = {10.1002/cplx.6130010105},
journal = {Complexity},
mendeley-groups = {dissertation},
month = {sep},
number = {1},
pages = {16--19},
publisher = {Wiley Subscription Services, Inc., A Wiley Company},
title = {{What is complexity?}},
url = {http://doi.wiley.com/10.1002/cplx.6130010105},
volume = {1},
year = {1995},
keywords = "nourl"
}
\end{filecontents}

\begin{document}

\nocite{*}
{
\renewcommand*{\mkbibnamegiven}[1]{%
  \ifitemannotation{corresponding}
    {\textbf{#1}}
    {#1}}
\renewcommand*{\mkbibnamefamily}[1]{%
  \ifitemannotation{corresponding}
    {\textbf{#1}}
    {#1}}

\printbibliography[title={bad author},heading=subbibliography,keyword=nourl]
}


\printbibliography[title={good author},heading=subbibliography,notkeyword=nourl]
\end{document}

在此处输入图片描述

相关内容