![根据关键字字段设置姓氏样式](https://linux22.com/image/322343/%E6%A0%B9%E6%8D%AE%E5%85%B3%E9%94%AE%E5%AD%97%E5%AD%97%E6%AE%B5%E8%AE%BE%E7%BD%AE%E5%A7%93%E6%B0%8F%E6%A0%B7%E5%BC%8F.png)
如何将参考书目中的姓氏变为小写,除了当关键字为“primary”时,如何为“author”添加注释?是的,我知道我可以全部使用 \textsc{…},但我希望这个过程可以自动化。
我认为我的问题的答案将衍生自https://tex.stackexchange.com/a/29862/60686。
梅威瑟:
\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage[english]{babel}
\usepackage[style=verbose-ibid,backend=biber,]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{roehrs2014,
author = {Dorian Roehrs},
title = {Inflections on Pre-Nominal Adjectives in Germanic},
subtitle = {Main types, Subtypes, and Subset Relations},
journaltitle = {Journal of Comparative Germanic Linguistics},
journalshorttitle = {JCGL},
volume = {18},
year = {2015},
pages = {213--271},
doi = {10.1007/s10828-015-9076-z},
keywords = {secondary},
}
@inbook{iwein-dkv,
author = {Hartmann von Aue},
title = {Iwein},
booktitle = {Gregorius -- Der arme Heinrich -- Iwein},
editor = {Volker Mertens},
translator = {Volker Mertens},
publisher = {Deutscher Klassiker Verlag},
location = {Frankfurt/Main},
year = {2008},
series = {Deutscher Klassiker Verlag im Taschenbuch},
number = {29},
pages = {317--767},
keywords = {primary},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\citeauthor{roehrs2014}\autocite{roehrs2014} and \citeauthor{iwein-dkv}\autocite{iwein-dkv}.
\nocite{*}
\printbibliography[keyword=primary, title={Primary Sources}, heading=subbibliography]
\printbibliography[keyword=secondary, title={Secondary Sources}, heading=subbibliography]
\end{document}
我想要的是,“Roehrs”和“Mertens”将采用小写字母,而“von Aue”将采用普通字体(忽略“von Aue”就像“da Vinci”一样,严格来说不是姓氏,但无论如何)。
答案1
我们可以使用\ifkeyword
内部\mkbibnamelast
\renewcommand*{\mkbibnamelast}[1]{%
\ifkeyword{primary}
{#1}
{\textsc{#1}}}
仅检查primary
,但你可以将它与更复杂的解决方案结合起来将作者姓氏设置为小写,但编辑、翻译等使用 biblatex 时应避免使用到
\def\ifmknamesc{%
\ifboolexpr{ test {\ifcurrentname{labelname}}
or test {\ifcurrentname{author}}
or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}
\renewcommand*{\mkbibnamelast}[1]{%
\ifboolexpr{test {\ifkeyword{primary}} and test {\ifmknamesc}}
{#1}
{\textsc{#1}}}
您可以将相同的方法应用于\mkbibnameprefix
“von”部分、\mkbibnamefirst
名字和\mkbibnameaffix
“junior”部分。在 MWE 中,我们更改了姓氏和“von”部分,但其余部分保持不变。
平均能量损失
\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[style=verbose-ibid,backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{roehrs2014,
author = {Dorian Roehrs},
title = {Inflections on Pre-Nominal Adjectives in Germanic},
subtitle = {Main types, Subtypes, and Subset Relations},
journaltitle = {Journal of Comparative Germanic Linguistics},
journalshorttitle = {JCGL},
volume = {18},
year = {2015},
pages = {213--271},
doi = {10.1007/s10828-015-9076-z},
keywords = {secondary},
}
@inbook{iwein-dkv,
author = {Hartmann von Aue},
title = {Iwein},
booktitle = {Gregorius -- Der arme Heinrich -- Iwein},
editor = {Volker Mertens},
translator = {Volker Mertens},
publisher = {Deutscher Klassiker Verlag},
location = {Frankfurt/Main},
year = {2008},
series = {Deutscher Klassiker Verlag im Taschenbuch},
number = {29},
pages = {317--767},
keywords = {primary},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\def\ifmknamesc{%
\ifboolexpr{ test {\ifcurrentname{labelname}}
or test {\ifcurrentname{author}}
or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}
\renewcommand*{\mkbibnamelast}[1]{%
\ifboolexpr{test {\ifkeyword{primary}} and test {\ifmknamesc}}
{#1}
{\textsc{#1}}}
\renewcommand*{\mkbibnameprefix}[1]{%
\ifboolexpr{test {\ifkeyword{primary}} and test {\ifmknamesc}}
{#1}
{\textsc{#1}}}
\begin{document}
\citeauthor{roehrs2014}\autocite{roehrs2014} and \citeauthor{iwein-dkv}\autocite{iwein-dkv}.
\nocite{*}
\printbibliography[keyword=primary, title={Primary Sources}, heading=subbibliography]
\printbibliography[keyword=secondary, title={Secondary Sources}, heading=subbibliography]
\end{document}