biblatex:將所有編輯器資訊放在括號中

biblatex:將所有編輯器資訊放在括號中

我想使用 biblatex 在收集參考中將所有編輯器資訊放在括號中。我目前的參考如下所示:

新澤西州戈特利和北卡羅來納州科爾韋爾 (2010)。估計物種豐富度。在:生物多樣性:測量和評估的前沿。 (編輯)Magurran,AE 和 McGill,BJ 牛津大學出版社,英國牛津,39-54。

但是,我希望此引用與所有編輯器資訊一起出現在括號中,後跟句點:

新澤西州戈特利和北卡羅來納州科爾韋爾 (2010)。估計物種豐富度。在:生物多樣性:測量和評估的前沿。 (AE Magurran 和 BJ McGill 編)。牛津大學出版社,英國牛津,39-54。

我目前的解決方案是使用 \xpatchbibmacro{byeditor+othersstrg}{\printtext}{\printtext[parens]}{}{},但此解決方案僅將 editor 的縮寫放在括號中。

我的MWE如下:

\documentclass[12pt,Bold]{report}

\usepackage[backend=bibtex,url=false, isbn=false, doi=false, style=authoryear,citestyle=authoryear, sorting=nyt,dashed=FALSE, maxcitenames=2, maxbibnames=100]{biblatex}
\usepackage{xpatch}
\usepackage{filecontents}


%Last names first in bibliography
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}

%italics for book titles
\DeclareFieldFormat[incollection]{title}{#1}
\DeclareFieldFormat[incollection]{booktitle}{\textit{#1}}


\DeclareFieldFormat[article,incollection]{pages}{#1}

\renewbibmacro*{volume+number+eid}{%
 \printfield{volume}%
  %\setunit*{\adddot}% DELETED
%  \setunit*{\addcolon}% ADDED
 % \printfield{number}%
  %\setunit{\space}%
  \printfield{eid}}

\renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }
    {\ifnumgreater{\value{liststop}}{1}
       {\finalandcomma}
       {}%
     \andothersdelim\bibstring[\emph]{andothers}}
    {}}
\renewcommand*{\finalnamedelim}{%
  \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
  \addspace\&\space}

%change order and punctuation between publisher and location
\renewbibmacro*{publisher+location+date}{%
  \printlist{publisher}%
  \iflistundef{location}
    {\setunit*{\addcomma\space}}
    {\setunit*{\addcomma\space}}%
  \printlist{location}%
  \setunit*{\addcomma\space}%
  \usebibmacro{date}%
  \newunit}


%change editor abbrevation
\DefineBibliographyStrings{english}{%
  byeditor = {\lowercase{ed}},%
  byeditor = {\lowercase{eds}},%
}

\xpatchbibmacro{byeditor+othersstrg}{\printtext}{\printtext[parens]}{}{}

\begin{filecontents*}{editor.mwe.bib}

@incollection{magurran_estimating_2010,
    address = {Oxford, United Kingdom},
    title = {Estimating species richness},
    shorttitle = {Estimating species richness},
    booktitle = {Biological diversity: frontiers in measurement and     assessment},
publisher = {Oxford University Press},
author = {Gotelli, N.J. and Colwell, R.K.},
editor = {Magurran, A.E. and McGill, B.J.},
year = {2010},
pages = {39--54},
}


\end{filecontents*}
\addbibresource{editor.mwe.bib}

\begin{document}

\parencite{magurran_estimating_2010}

\printbibliography
\end{document}

任何幫助將不勝感激,因為我幾週來一直在尋找解決方案。

答案1

我建議按照以下方式重新定義

\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\printtext[parens]{\usebibmacro{byeditor+othersstrg}%
     \setunit{\addspace}%
     \printnames[byeditor]{editor}}%
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

我們\printtext[parens]在區塊列印編輯器周圍添加了一個。如果您還有editoras 或translators等,可能會有一些缺點。

微量元素

\documentclass{article}
\usepackage[backend=bibtex,url=false, isbn=false, doi=false, style=authoryear,citestyle=authoryear, sorting=nyt,dashed=FALSE, maxcitenames=2, maxbibnames=100]{biblatex}
\usepackage{xpatch}
\usepackage{filecontents}

%Last names first in bibliography
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}

%italics for book titles
\DeclareFieldFormat[incollection]{title}{#1}
\DeclareFieldFormat[incollection]{booktitle}{\textit{#1}}


\DeclareFieldFormat[article,incollection]{pages}{#1}

\renewbibmacro*{volume+number+eid}{%
 \printfield{volume}%
  %\setunit*{\adddot}% DELETED
%  \setunit*{\addcolon}% ADDED
 % \printfield{number}%
  %\setunit{\space}%
  \printfield{eid}}

\renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }
    {\ifnumgreater{\value{liststop}}{1}
       {\finalandcomma}
       {}%
     \andothersdelim\bibstring[\emph]{andothers}}
    {}}
\renewcommand*{\finalnamedelim}{%
  \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
  \addspace\&\space}

%change order and punctuation between publisher and location
\renewbibmacro*{publisher+location+date}{%
  \printlist{publisher}%
  \iflistundef{location}
    {\setunit*{\addcomma\space}}
    {\setunit*{\addcomma\space}}%
  \printlist{location}%
  \setunit*{\addcomma\space}%
  \usebibmacro{date}%
  \newunit}


%change editor abbrevation
\DefineBibliographyStrings{english}{%
  byeditor = {\lowercase{ed}},%
  byeditor = {\lowercase{eds}},%
}

\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\printtext[parens]{\usebibmacro{byeditor+othersstrg}%
     \setunit{\addspace}%
     \printnames[byeditor]{editor}}%
     \clearname{editor}%
     \newunit}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}


\begin{filecontents*}{\jobname.bib}

@incollection{magurran_estimating_2010,
    address = {Oxford, United Kingdom},
    title = {Estimating species richness},
    shorttitle = {Estimating species richness},
    booktitle = {Biological diversity: frontiers in measurement and     assessment},
publisher = {Oxford University Press},
author = {Gotelli, N.J. and Colwell, R.K.},
editor = {Magurran, A.E. and McGill, B.J.},
year = {2010},
pages = {39--54},
}


\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}

\parencite{magurran_estimating_2010}

\printbibliography
\end{document}

在此輸入影像描述

相關內容