有人写了几本书,但在包含和/或缩写中间名方面,他在每本书中的做法不一致。当我在文本中引用这位作者时,我想biblatex
将他名字的所有不同版本视为同一作者。我可以使用 强制执行此操作以对参考书目进行排序sortname
,但我该如何强制执行此操作以对文本引用进行排序?
以下示例说明了文本引文如何将“Paul J[ohn] Smith”视为与“Paul John Smith”和“Paul Smith”不同的作者。第一个引文应显示为 (Smith 2002),第二个引文应显示为 (2001a, 2001b, 2002)。
\documentclass{article}
\usepackage{csquotes}
\usepackage[
bibstyle = authoryear,
citestyle = authoryear-comp,
dashed = false,
sorting = nyt,
sortcites = false,
language = american,
abbreviate = false,
backend = biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{smith2001a,
AUTHOR = "Paul John Smith",
TITLE = "My first book",
YEAR = "2001"}
@BOOK{smith2001b,
AUTHOR = "Paul Smith",
TITLE = "My second book",
YEAR = "2001",
SORTNAME = "Paul John Smith"}
@BOOK{smith2002,
AUTHOR = "Paul J[ohn] Smith",
TITLE = "My third book",
YEAR = "2002",
SORTNAME = "Paul John Smith"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\noindent
Some clever guy said that \parencite{smith2002}.
In fact, Paul Smith has talked about this several times \parencite*{smith2001a,smith2001b,smith2002}.
\printbibliography
\end{document}
答案1
现在有一个 biblatex 宏接口用于源映射功能,您可以将其放在您的序言中:
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=author, match=\regexp{Paul\s+(?:J\S+\s+)?Smith}, final]
\step[fieldset=shortauthor, fieldvalue={Smith, Paul John}]
\step[fieldset=sortname, fieldvalue={Smith, Paul John}]
}
}
}
您可能需要调整正则表达式,我将其做得非常具体,以免捕获任何不应该捕获的内容。
答案2
这只是为了展示上述 PLK 的解决方案在实践中是如何发挥作用的:
\documentclass{article}
\usepackage{csquotes}
\usepackage[
bibstyle = authoryear,
citestyle = authoryear-comp,
dashed = false,
sorting = nyt,
sortcites = false,
language = american,
abbreviate = false,
backend = biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{smith2001a,
AUTHOR = "Paul John Smith",
TITLE = "My first book",
YEAR = "2001"}
@BOOK{smith2001b,
AUTHOR = "Paul Smith",
TITLE = "My second book",
YEAR = "2001",
SORTNAME = "Paul John Smith"}
@BOOK{smith2002,
AUTHOR = "Paul J[ohn] Smith",
TITLE = "My third book",
YEAR = "2002",
SORTNAME = "Paul John Smith"}
\end{filecontents}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=author, match=\regexp{Paul\s+(?:J\S+\s+)?Smith}, final]
\step[fieldset=shortauthor, fieldvalue={Smith, Paul John}]
\step[fieldset=sortname, fieldvalue={Smith, Paul John}]
}
}
}
\begin{document}
\noindent
Some clever guy said that \parencite{smith2002}.
In fact, Paul Smith has talked about this several times \parencite*{smith2001a,smith2001b,smith2002}.
\printbibliography
\end{document}