我如何修改参考书目样式以包含 xpatch 的注释?

我如何修改参考书目样式以包含 xpatch 的注释?

我需要使用该biblatex-sbl包创建一个带注释的参考书目。我设法通过创建自定义bbx文件来破解一些东西,但我被告知这xpatch是一种可能、更优雅的解决方案。在浏览文档并阅读了一些内容后,我还没有找到自己的解决方案。以下是工作 tex 文件的示例:

\documentclass[letterpaper,12pt,oneside,openany]{book}

\usepackage{sbl-paper}
\usepackage[backend=biber]{biblatex}

\begin{filecontents}{selectedworks.bib}
@article{Sasson:1966aa,
    Author = {Sasson, Jack M.},
    Date-Added = {2017-10-27 23:26:58 +0000},
    Date-Modified = {2017-11-14 01:28:31 +0000},
    Issn = {0021-9231},
    Journaltitle = {Journal of Biblical Literature},
    Number = {4},
    Pages = {473-476},
    Title = {Circumcision in the Ancient Near East},
    Volume = {85},
    Year = {1966},
    Annote = {Annotation text.}}

@article{Polaski:1998aa,
    Author = {Polaski, Donald C.},
    Date-Added = {2017-10-27 23:24:22 +0000},
    Date-Modified = {2017-10-27 23:26:44 +0000},
    Issn = {03090892},
    Journaltitle = {Journal for the Study of the Old Testament},
    Number = {77},
    Pages = {55-73},
    Title = {Reflections on a Mosaic Covenant: The Eternal Covenant (Isaiah 24:5) and Intertextuality},
    Year = {1998},
    Annote = {Annotation text.}}

@article{Mor:2012aa,
    Author = {Mor, Menahem},
    Date-Added = {2017-10-27 23:19:43 +0000},
    Date-Modified = {2017-10-27 23:23:18 +0000},
    Issn = {12242284},
    Pages = {161-193},
    Title = {Are There Any New Factors Concering the Bar Kokhba Revolt?},
    Volume = {18},
    Year = {2012},
    Annote = {Annotation text.}}
\end{filecontents}

\addbibresource{selectedworks.bib}

\begin{document}

\nocite{Sasson:1966aa}
\nocite{Mor:2012aa}
\nocite{Polaski:1998aa}

\printbibliography[title=Annotated Bibliography]
\end{document}

在 中定义如下sbl.bbx

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \newunit
  \usebibmacro{title}%
  \newunit
  \usebibmacro{bytranslator+others}%
  \newunit
  \usebibmacro{inissuetitle}%
  \newunit
  \printfield{version}%
  \newunit
  \printlist{organization}%
  \newunit
  \printfield{note}%
  \newunit
  \usebibmacro{shortjournal+issue}%
  \usebibmacro{pages}%
  \newunit
  \printfield{addendum}%
  \newunit
  \usebibmacro{issn}%
  \newunit
  \usebibmacro{doi+eprint+url}%
  \newunit
  \ifboolexpr{
    togl {relatedseen}
    or
    not togl {bbx:related}
  }
    {}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}%
  \usebibmacro{finentry}%
}

我想添加类似以下内容以合并注释:

  \par
  \usebibmacro{annotation}
  \newunit\newblock

答案1

您可以使用:

\xpatchbibdriver{article}{%
    \usebibmacro{finentry}%
    }{%
    \setunit\par
    \usebibmacro{annotation}%
    \newunit\newblock
    \usebibmacro{finentry}%
    }{}{}

在此处输入图片描述

根据 xpatch 的文档,的语法xpatchbibdriver是:

\xpatchbibdriver{<name>}{<search>}{<replace>}{<success>}{<failure>}

\usebibmacro{finentry}%因此我们在 bibdriver 中搜索article并将其替换为添加的感兴趣的内容。

或完整内容:

\documentclass[letterpaper,12pt,oneside,openany]{book}

\usepackage{sbl-paper}
\usepackage[backend=biber]{biblatex}
\usepackage{xpatch}

\begin{filecontents}{selectedworks.bib}
@article{Sasson:1966aa,
    Author = {Sasson, Jack M.},
    Date-Added = {2017-10-27 23:26:58 +0000},
    Date-Modified = {2017-11-14 01:28:31 +0000},
    Issn = {0021-9231},
    Journaltitle = {Journal of Biblical Literature},
    Number = {4},
    Pages = {473-476},
    Title = {Circumcision in the Ancient Near East},
    Volume = {85},
    Year = {1966},
    Annote = {Annotation text.}}

@article{Polaski:1998aa,
    Author = {Polaski, Donald C.},
    Date-Added = {2017-10-27 23:24:22 +0000},
    Date-Modified = {2017-10-27 23:26:44 +0000},
    Issn = {03090892},
    Journaltitle = {Journal for the Study of the Old Testament},
    Number = {77},
    Pages = {55-73},
    Title = {Reflections on a Mosaic Covenant: The Eternal Covenant (Isaiah 24:5) and Intertextuality},
    Year = {1998},
    Annote = {Annotation text.}}

@article{Mor:2012aa,
    Author = {Mor, Menahem},
    Date-Added = {2017-10-27 23:19:43 +0000},
    Date-Modified = {2017-10-27 23:23:18 +0000},
    Issn = {12242284},
    Pages = {161-193},
    Title = {Are There Any New Factors Concering the Bar Kokhba Revolt?},
    Volume = {18},
    Year = {2012},
    Annote = {Annotation text.}}
\end{filecontents}

\addbibresource{selectedworks.bib}

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \newunit
  \usebibmacro{title}%
  \newunit
  \usebibmacro{bytranslator+others}%
  \newunit
  \usebibmacro{inissuetitle}%
  \newunit
  \printfield{version}%
  \newunit
  \printlist{organization}%
  \newunit
  \printfield{note}%
  \newunit
  \usebibmacro{shortjournal+issue}%
  \usebibmacro{pages}%
  \newunit
  \printfield{addendum}%
  \newunit
  \usebibmacro{issn}%
  \newunit
  \usebibmacro{doi+eprint+url}%
  \newunit
  \ifboolexpr{
    togl {relatedseen}
    or
    not togl {bbx:related}
  }
    {}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}%
  \usebibmacro{finentry}%
}


\xpatchbibdriver{article}{%
    \usebibmacro{finentry}%
    }{%
    \setunit\par
    \usebibmacro{annotation}%
    \newunit\newblock
    \usebibmacro{finentry}%
    }{}{}


\begin{document}

\nocite{Sasson:1966aa}
\nocite{Mor:2012aa}
\nocite{Polaski:1998aa}

\printbibliography[title=Annotated Bibliography]
\end{document}

相关内容