参考书目中 Ed. / Eds. 的条件格式

参考书目中 Ed. / Eds. 的条件格式

对于特定类型的馆藏出版物(关键字:B),我想使用不同的名称,而不是 Ed. 或 Eds。到目前为止,我已经使用 \DeclareSourcemap 和覆盖来尝试完成此操作,但失败了。有没有人知道如何有选择地更改 Ed. 以进行选择性引用,如下例所示?

具体来说,对于 BI 类型的出版物,结果应为:“In B. Smith (Chair)”而不是“In A. Smith (Ed.)”或“In B. Smith & B. Meyer (Chairs)”而不是“In A. Smith & A. Meyer (Eds.)”,而对于 A 类型的出版物,结果应保持不变。

\documentclass{article}

\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage{extarrows}
\usepackage{csquotes}
\usepackage[style=apa,
        bibencoding=utf8,
        sortcites=true,
        bibwarn=true,
        firstinits=true,
        isbn=false,
        dashed=false,
        maxbibnames=99,
        babel=other,
        backend=biber,
        hyperref=true]{biblatex}

\begin{filecontents}{works.bib}

@incollection{articleA,
  author  = {Adams, A.}, 
  title   = {Titel},
  year = {2017},
  booktitle  = {Booktitle},
  editor = {Smith, A.},
  pages   = {201-213},
  keywords = {A},
}

@incollection{articleB,
  author  = {Adams, A.}, 
  title   = {Titel},
  year = {2017},
  booktitle  = {Booktitle},
  editor = {Smith, B.},
  pages   = {201-213},
  keywords = {B},
}

\end{filecontents}


\addbibresource{works.bib} 


\begin{document}
\nocite{*}
\printbibliography[keyword=A,title={A}]
\printbibliography[keyword=B,title={B}]

\end{document}

答案1

您需要利用该editortype领域。

您可以将其添加到您的 bib 条目中,例如,

@incollection{articleB,
  author  = {Adams, A.}, 
  title   = {Title},
  year = {2017},
  booktitle  = {Booktitle},
  editor = {Smith, B.},
  editortype = {chair},
  pages   = {201-213},
  keywords = {B},
}

或者您可以使用源映射将其添加到满足的所有条目keyword = {B},例如,

\DeclareSourcemap{
  \maps{
    \map{
      % there is probably a better regex than this...
      \step[fieldsource=keywords, match=\regexp{(^B$|^B[^\w]|[^\w]B$|,B,)}, final]
      \step[fieldset=editortype, fieldvalue={chair}]
    }
  }
}

无论哪种方式,您都需要定义一个新的参考书目字符串,如下typechair所示:

\NewBibliographyString{typechair}
\DefineBibliographyStrings{american}{%
  typechair = {chair}
}

你不必typechairs为英语定义一个字符串(至少),因为biblatex它足够聪明,可以猜到你只是想要一个s位于复数末尾。

这是完整的 MWE(使用源映射选项):

\documentclass{article}
\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[style=apa,
        bibencoding=utf8,
        sortcites=true,
        bibwarn=true,
        firstinits=true,
        isbn=false,
        dashed=false,
        maxbibnames=99,
        babel=other,
        backend=biber,
        hyperref=true]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{articleA,
  author  = {Adams, A.}, 
  title   = {Title},
  year = {2017},
  booktitle  = {Booktitle},
  editor = {Smith, A.},
  pages   = {201-213},
  keywords = {A},
}
@incollection{articleB,
  author  = {Adams, A.}, 
  title   = {Title},
  year = {2017},
  booktitle  = {Booktitle},
  editor = {Smith, B.},
  pages   = {201-213},
  keywords = {B},
}
@incollection{articleC,
  author  = {Adams, A.}, 
  title   = {Title},
  year = {2017},
  booktitle  = {Booktitle},
  editor = {Smith, B. and Meyer, B.},
  pages   = {201-213},
  keywords = {B},
}
\end{filecontents}
\addbibresource{\jobname.bib} 
\NewBibliographyString{typechair}
\DefineBibliographyStrings{american}{%
  typechair = {chair}
}
\pagestyle{empty}
\DeclareSourcemap{
  \maps{
    \map{
      % there is probably a better regex than this...
      \step[fieldsource=keywords, match=\regexp{(^B$|^B[^\w]|[^\w]B$|,B,)}, final]
      \step[fieldset=editortype, fieldvalue={chair}]
    }
  }
}
\begin{document}
\nocite{*}
\printbibliography[keyword=A,title={A}]
\printbibliography[keyword=B,title={B}]
\end{document}

在此处输入图片描述

相关内容