在 biblatex 中将编辑姓名后跟 (Ed./Eds.) 和标题前的逗号

在 biblatex 中将编辑姓名后跟 (Ed./Eds.) 和标题前的逗号

对于我遵循的样式表,我需要将书籍编辑的姓名移到书名之前。在 中biblatex,默认行为是打印Ed. by后跟姓名。之前也曾有人问过类似的问题 (使用 biblatex 引用@inbook:如何将作者/编辑放在书名之前?),但给出的答案在很多方面与我的需要不同,而且我不知道如何修改它以满足我的需要。

在MWE中,打印的结果是:

列侬,约翰(1965 年)。这是我在这本书中的文章。一本有文章的书。保罗·麦卡特尼、约翰·列侬、乔治·哈里森和理查德·斯塔基编。利物浦:洞穴俱乐部。65-87。

而我需要的是:

列侬,约翰(1965 年)。这是我在这本书中的文章。保罗·麦卡特尼、约翰·列侬、乔治·哈里森和理查德·斯塔基(编)一本有文章的书. 利物浦:洞穴俱乐部。65-87。

注意大写的Ein (在单个编辑器的情况下Eds.应该是)和其后的逗号。Ed.

\documentclass{article}
\usepackage[style = authoryear-comp, maxnames = 99]{biblatex}

\renewcommand*{\finalnamedelim}{\addspace\&\space} % use '&' before last author in citations and bibliography
\renewcommand*{\intitlepunct}{\space} % remove colon after "In:" for articles in books
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % no word 'pages' for articles in the bibliography (print as is)
\DeclareFieldFormat[article, incollection, unpublished]{title}{#1} % no quotes for article titles (print as is)
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}} % colon between volume and page ranges for journal articles, period plus space for articles in books

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{lennon1965,
    AUTHOR = "John Lennon",
    BOOKTITLE = "A book with articles",
    EDITOR = "Paul McCartney and John Lennon and George Harrison and Richard Starkey",
    TITLE = "This is my article in this book",
    YEAR = "1965",
    LOCATION = "Liverpool",
    PAGES = "65--87",
    PUBLISHER = "Cavern Club"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

在此处输入图片描述

答案1

无耻的广告:biblatex-extbundle 有一个稍微复杂一点的版本,作为选项实现。加载ext-<standardstyle>,例如,ext-authoryear-comp并将选项设置innamebeforetitletrue

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber,
  style=ext-authoryear, innamebeforetitle=true]{biblatex}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

\DeclareFieldAlias{translatortype}{editortype}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson,gaonkar:in,westfahl:space,vizedom:related}
\printbibliography
\end{document}

Gaonkar, Dilip Parameshwar (2001)。《论另类现代性》。收录于:Dilip Parameshwar Gaonkar (编)。《另类现代性》。达勒姆和伦敦:杜克大学出版社,第 1-23 页。isbn:0-822-32714-7。//Sigfridsson, Emma 和 Ulf Ryde (1998)。《从静电势和力矩推导原子电荷的方法比较》。收录于:《计算化学杂志》19.4,第 377-395 页。doi:10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P。//Vizedom, Monika B. 和 Gabrielle L. Caffee (译) (1960)。《成年礼》。芝加哥大学出版社。Arnold van Gennep 译。《Les rites de passage》。巴黎:Nourry,1909 年。//Westfahl,Gary(2000 年)。《真正的边疆。美国科幻电影中太空现实的对抗与回避》。收录于:Gary Westfahl(编)。《太空及其之外。科幻小说中的边疆主题》。康涅狄格州韦斯特波特和伦敦:Greenwood,第 55-65 页。

这确实是biblatex不太灵活的地方。

我们可以使用xpatch修补驱动程序@inbook@incollection以及@inproceedings

\xpatchbibdriver{inbook}
  {\usebibmacro{in:}%
   \usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{byeditor:in}%
   \newunit\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}

\xpatchbibdriver{incollection}
  {\usebibmacro{in:}%
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{byeditor:in}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor}}
  {}{}

\xpatchbibdriver{inproceedings}
  {\usebibmacro{in:}%
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{event+venue+date}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{byeditor:in}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{event+venue+date}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}

我们还重新定义byeditor:in

\newbibmacro*{byeditor:in}{%
  \ifnameundef{editor}
    {}
    {\printnames[editorin]{editor}%
     \addspace\bibsentence%
     \mkbibparens{\usebibmacro{editorstrg}}%
     \clearname{editor}%
     \printunit{\addcomma\space}}}

以及新的名称格式

\DeclareNameAlias{editorin}{first-last}

平均能量损失

\documentclass{article}
\usepackage{xpatch}
\usepackage[style = authoryear-comp, maxnames = 99]{biblatex}

\renewcommand*{\finalnamedelim}{\addspace\&\space}
\renewcommand*{\intitlepunct}{\space}
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1}
\DeclareFieldFormat[article, incollection, unpublished]{title}{#1}
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@incollection{lennon1965,
  author    = {John Lennon},
  booktitle = {A book with articles},
  editor    = {Paul McCartney and John Lennon and George Harrison and Richard Starkey},
  title     = {This is my article in this book},
  year      = {1965},
  location  = {Liverpool},
  pages     = {65--87},
  publisher = {Cavern Club},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\DeclareNameAlias{editorin}{first-last}

\newbibmacro*{byeditor:in}{%
  \ifnameundef{editor}
    {}
    {\printnames[editorin]{editor}%
     \addspace\bibsentence%
     \mkbibparens{\usebibmacro{editorstrg}}%
     \clearname{editor}%
     \printunit{\addcomma\space}}}

\xpatchbibdriver{inbook}
  {\usebibmacro{in:}%
   \usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{bybookauthor}%
   \newunit\newblock
   \usebibmacro{byeditor:in}%
   \newunit\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}

\xpatchbibdriver{incollection}
  {\usebibmacro{in:}%
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{byeditor:in}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{byeditor}}
  {}{}

\xpatchbibdriver{inproceedings}
  {\usebibmacro{in:}%
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{event+venue+date}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {\usebibmacro{in:}%
   \usebibmacro{byeditor:in}%
   \setunit{\labelnamepunct}\newblock
   \usebibmacro{maintitle+booktitle}%
   \newunit\newblock
   \usebibmacro{event+venue+date}%
   \newunit\newblock
   \usebibmacro{byeditor+others}}
  {}{}



\begin{document}
\nocite{*}
\printbibliography
\end{document}

在此处输入图片描述

答案2

Guidos 的方式,或者 - 不使用其他包,但使用更多的代码行 - 您可以更改 bibliography-driver 为@incollectionfrom standard.bbx,以按您想要的顺序显示数据;更改 -macro byeditor+othersfrombiblatex.def以在编辑器数据周围放置括号;并更改editorstrgfrombiblatex.def以使用大写版本\bibcpstring而不是\bibstring

\documentclass{article}
\usepackage[style = authoryear-comp, maxnames = 99]{biblatex}

\renewcommand*{\finalnamedelim}{\addspace\&\space} % use '&' before last author in citations and bibliography
\renewcommand*{\intitlepunct}{\space} % remove colon after "In:" for articles in books
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % no word 'pages' for articles in the bibliography (print as is)
\DeclareFieldFormat[article, incollection, unpublished]{title}{#1} % no quotes for article titles (print as is)
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}} % colon between volume and page ranges for journal articles, period plus space for articles in books

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{lennon1965,
    AUTHOR = "John Lennon",
    BOOKTITLE = "A book with articles",
    EDITOR = "Paul McCartney and John Lennon and George Harrison and Richard Starkey",
    TITLE = "This is my article in this book",
    YEAR = "1965",
    LOCATION = "Liverpool",
    PAGES = "65--87",
    PUBLISHER = "Cavern Club"}
\end{filecontents}
\addbibresource{\jobname.bib}
\renewbibmacro*{editorstrg}{%from biblatex.def
  \printtext[editortype]{%
    \iffieldundef{editortype}
      {\ifboolexpr{
         test {\ifnumgreater{\value{editor}}{1}}
         or
         test {\ifandothers{editor}}
       }
         {\bibcpstring{editors}}%changed
         {\bibcpstring{editor}}}%changed
      {\ifbibxstring{\thefield{editortype}}
         {\ifboolexpr{
            test {\ifnumgreater{\value{editor}}{1}}
            or
            test {\ifandothers{editor}}
          }
            {\bibcpstring{\thefield{editortype}s}}%changed
            {\bibcpstring{\thefield{editortype}}}}%changed
         {\thefield{editortype}}}}}


\renewbibmacro*{byeditor+others}{%from biblatex.def
  \ifnameundef{editor}
    {}
    {\printnames[byeditor]{editor}%
     \addspace%added
     \mkbibparens{\usebibmacro{editorstrg}}%added
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

\DeclareBibliographyDriver{incollection}{%from standard.bbx
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%changed
  \usebibmacro{byeditor+others}%changed
  \setunit{\addcomma\addspace}\newblock%changed
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\begin{document}
\nocite{*}
\printbibliography
\end{document}



输出:

输出

答案3

编辑maintitle修复了多卷(带有)和单个编辑器的问题。

一种可能性是滥用 biblatexin:宏来根据需要格式化和打印信息。

\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}
\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}

\renewbibmacro*{in:}{
  \ifentrytype{incollection}{%
  \DeclareNameAlias{editor}{first-last}
  \printtext{In}
  \ifnameundef{editor}
    {}
    {\printnames{editor}%
     \addspace 
     \mkbibparens{\usebibmacro{editorstrg}}
     \setunit{\addcomma\addspace}% 
    }%
  \usebibmacro{maintitle+booktitle}
  \clearfield{maintitle}
  \clearfield{booktitle}
  \clearfield{volume}
  \clearfield{part}
  \clearname{editor}
  }
  {}%
}

在这种情况下,“简单”in:包含打印编辑和书名的指令。

这些技巧包括:(1)使用保护,,\ifentrytype{incollection}将修改限制在特定的entrytype上;(2)删除字段booktitle和的内容editor,因此它们在驱动程序的其余指令中不再可用incollection,以及(3)定义一个新指令来切换编辑器的姓氏和名字:这可以是指定editor是预定义名称格式的“别名” first-last,即\DeclareNameAlias{editor}{first-last}

请注意,使用出色且方便的xpatch包(即 include \usepackage{xpatch})来修改 biblatex 字符串编辑器的打印方式。请注意,我们需要修补两次:第一次针对复数版本,第二次针对单数情况(只有一个编辑器)。

结果如下:

在此处输入图片描述

相关内容