有些人寫了幾本書,但在包含和/或縮寫他的中間名方面,他在每一本書中都不一致。當我在文本中引用該作者時,我想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}