如果 biblatex 中 @inproceedings 有多个编辑者,我想将“ed.”改为“eds.”
以下是 MWE:
\documentclass{article}
% required for \xpatchbibmacro
\usepackage{xpatch}
\usepackage{csquotes}
\usepackage[
backend=biber,
defernumbers=true,
style=numeric,
autocite = superscript,
date=year,
]
{biblatex}
% Some general changes for reference format
\DeclareNameAlias{sortname}{last-first}
\renewcommand*{\bibinitdelim}{}
\renewbibmacro*{in:}{%
\iffieldequalstr{entrytype}{inproceedings}{%
\printtext{\bibstring{in}\addspace}%
}{}%
}
% Changes for Book
\csletcs{abx@macro@publisher+location+date@orig}{abx@macro@publisher+location+date}
\renewbibmacro*{publisher+location+date}{%
\printtext[parens]{\usebibmacro{publisher+location+date@orig}}
}
\DeclareFieldFormat[book]{title}{#1\printunit{\addspace}}
% Changes for inproceedings
\DeclareFieldFormat[inproceedings]{title}{#1\isdot}
\DeclareFieldFormat{booktitle}{#1\addcomma}
\xpatchbibmacro{byeditor+others}{%
\usebibmacro{byeditor+othersstrg}%
\setunit{\addspace}%
\printnames[byeditor]{editor}%
\clearname{editor}%
}{%
\printnames[byeditor]{editor}%
\clearname{editor}
\addcomma\addspace
\bibstring{editor}
\setunit{\addspace}%
}{}{}
\begin{filecontents}[force]{\jobname.bib}
@inproceedings{moraux,
author = {Moraux, Paul},
editor = {Lloyd, G. E. R. and Owen, G. E. L.},
title = {Le \emph{De Anima} dans la tradition gr{\`e}cque},
date = 1979,
booktitle = {Aristotle on Mind and the Senses},
subtitle = {Quelques aspects de l'interpretation du trait{\'e}, de
Theophraste {\`a} Themistius},
booktitleaddon= {Proceedings of the Seventh Symposium Aristotelicum},
eventdate = 1975,
publisher = cup,
location = {Cambridge},
pages = {281-324},
keywords = {secondary},
langid = {french},
indexsorttitle= {De Anima dans la tradition grecque},
indextitle = {\emph{De Anima} dans la tradition gr{\`e}cque, Le},
shorttitle = {\emph{De Anima} dans la tradition gr{\`e}cque},
annotation = {This is a typical \texttt{inproceedings} entry. Note the
\texttt{booksubtitle}, \texttt{shorttitle},
\texttt{indextitle}, and \texttt{indexsorttitle} fields. Also
note the \texttt{eventdate} field.},
}
@inproceedings{salam,
author = {Salam, Abdus},
editor = {Svartholm, Nils},
title = {Weak and Electromagnetic Interactions},
date = 1968,
booktitle = {Elementary particle theory},
booksubtitle = {Relativistic groups and analyticity},
booktitleaddon= {Proceedings of the {Eighth Nobel Symposium}},
eventdate = {1968-05-19/1968-05-25},
venue = {Aspen{\"a}sgarden, Lerum},
publisher = {Almquist \& Wiksell},
location = {Stockholm},
pages = {367-377},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
输出如下:
我想将其更改G. E. R. Lloyd and G. E. L. Owen, ed.
为G. E. R. Lloyd and G. E. L. Owen, eds.
,同时保持Nils Svartholm, ed.
原样。
(如果可以同时改为幸福,但我明白这应该是一个单独的问题。Nils Svartholm, ed.
)N. Svartholm, ed.
非常感谢!
编辑
@moewe 提供的解决方案对于我提供的 MWE 来说无疑是成功的。
不幸的是,我的 MWE 太过简单(?supramimimal)并且省略了参考书目的一个重要方面,即bibstyle=authoryear
。
bibstyle=authoryear
下面显示了结合@moewe 解决方案的新 MWE 及其引起的新问题。
\documentclass{article}
\usepackage{xpatch}
\usepackage{csquotes}
\usepackage[
backend=biber,
style=numeric,
bibstyle=authoryear,
defernumbers=true,
autocite = superscript,
date=year,
]{biblatex}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\bibinitdelim}{}
\renewcommand*{\intitlepunct}{\addspace}
\renewbibmacro*{in:}{%
\ifentrytype{inproceedings}
{\bibstring{in}%
\printunit{\intitlepunct}}
{}%
}
\letbibmacro{publisher+location+date@orig}{publisher+location+date}
\renewbibmacro*{publisher+location+date}{%
\printtext[parens]{\usebibmacro{publisher+location+date@orig}}
}
\DeclareFieldFormat[book]{title}{#1\printunit{\addspace}}
\DeclareFieldFormat[inproceedings]{title}{#1\isdot}
\DeclareFieldFormat{booktitle}{#1\addcomma}
\letbibmacro{byeditor+others}{editor+others} % gives double title
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{moraux,salam,baez/article}
\printbibliography
\end{document}
问题在于:
(1)@article 现在有两个标题和日期。我想保留Author (Date). Title
等(不是第二次出现的Title (Date),
(2)在@article中,标题用引号括起来。
(3)在@inproceedings 中,编辑的名字用破折号代替。
(4)在@inproceedings中,ed.
已成为Ed.
,并且eds.
已成为Eds.
。
谢谢你!
答案1
补丁byeditor+others
仅包含显式\bibstring{editor}
,并且不检查是否有多个编辑器。这可以通过从editor+others
bibmacro 复制相关位来更改,但由于这只会复制byeditor+others
,editor+others
我们可以直接使用\letbibmacro
来复制。
\documentclass{article}
\usepackage{xpatch}
\usepackage{csquotes}
\usepackage[
backend=biber,
style=numeric,
defernumbers=true,
autocite = superscript,
date=year,
]{biblatex}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\bibinitdelim}{}
\renewcommand*{\intitlepunct}{\addspace}
\renewbibmacro*{in:}{%
\ifentrytype{inproceedings}
{\bibstring{in}%
\printunit{\intitlepunct}}
{}%
}
\letbibmacro{publisher+location+date@orig}{publisher+location+date}
\renewbibmacro*{publisher+location+date}{%
\printtext[parens]{\usebibmacro{publisher+location+date@orig}}
}
\DeclareFieldFormat[book]{title}{#1\printunit{\addspace}}
\DeclareFieldFormat[inproceedings]{title}{#1\isdot}
\DeclareFieldFormat{booktitle}{#1\addcomma}
\letbibmacro{byeditor+others}{editor+others}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{moraux,salam}
\printbibliography
\end{document}
如果您使用authoryear
或authortitle
(或任何其他支持该dashed
选项的样式)作为参考书目样式,则必须手动将的标准定义复制editor+others
到中byeditor+others
,因为这些样式会editor+others
用实现破折号的定义覆盖,而我们不希望破折号出现在我们的条目中间。
\documentclass{article}
\usepackage{xpatch}
\usepackage{csquotes}
\usepackage[
backend=biber,
style=authoryear,
defernumbers=true,
autocite = superscript,
date=year,
]{biblatex}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\bibinitdelim}{}
\renewcommand*{\intitlepunct}{\addspace}
\renewbibmacro*{in:}{%
\ifentrytype{inproceedings}
{\bibstring{in}%
\printunit{\intitlepunct}}
{}%
}
\letbibmacro{publisher+location+date@orig}{publisher+location+date}
\renewbibmacro*{publisher+location+date}{%
\printtext[parens]{\usebibmacro{publisher+location+date@orig}}
}
\DeclareFieldFormat[book]{title}{#1\printunit{\addspace}}
\DeclareFieldFormat[inproceedings]{title}{#1\isdot}
\DeclareFieldFormat{booktitle}{#1\addcomma}
\renewbibmacro*{byeditor+others}{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames{editor}%
\setunit{\printdelim{editortypedelim}}%
\usebibmacro{editor+othersstrg}%
\clearname{editor}}
{}}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{moraux,salam}
\printbibliography
\end{document}