如何将字段注释移至参考文献末尾

如何将字段注释移至参考文献末尾

我正在使用该note字段添加原始出版日期,并且我想将其打印在参考文献的末尾而不是出版商信息之前。

我看了这里并尝试提出类似的解决方案。我的宏仍然不起作用:字段note不会改变位置。

\RequirePackage{filecontents}

\begin{filecontents*}{mybib.bib}
@book{habermas_structural_1989,
    address = {Cambridge, {MA}},
    title = {The structural transformation of the public sphere: {An} inquiry into a category of bourgeois society},
    publisher = {MIT {Press}},
    author = {Habermas, Jürgen},
    translator = {Burger, Thomas and Lawrence, Frederick},
    year = {1989},
    note = {({Original} work published 1962)}
}
\end{filecontents*}

\documentclass{article}


% Set the values for the bibliography
\usepackage[
    style=apa,
    backend=biber,
    isbn=false,
    url=false,
    doi=false,
    eprint=false,
    hyperref=true,
    backref=false,
    firstinits=false,
]{biblatex}

\renewbibmacro*{publisher+note}{%
  \printlist{publisher}%
  \setunit*{\addperiod\space}%
  \usebibmacro{note}%
  \newunit}

% Recommended by biblatex
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{xpatch}

% Set language
\usepackage[british]{babel}
\DeclareLanguageMapping{british}{british-apa}

\addbibresource{mybib.bib}

\begin{document}

\cite{habermas_structural_1989}

\printbibliography
\end{document}

答案1

biblatex文档第 14 页指出:“这 [该addendum字段] 与该字段类似note,只是它打印在参考书目条目的末尾。”

因此,note最好使用addendum. biblatex-apa自动包装addendum到括号中,这样就无需手动执行此操作。

注意:最好让 来biblatex处理这种情况:总是记得在单词周围加上括号是相当累人的,如果你想去掉它们怎么办?

因此文件中的条目.bib应该是这样的。

@book{habermas_structural_1989_addendum,
    address = {Cambridge, {MA}},
    title = {The structural transformation of the public sphere: {An} inquiry into a category of bourgeois society},
    publisher = {MIT {Press}},
    author = {Habermas, Jürgen},
    translator = {Burger, Thomas and Lawrence, Frederick},
    year = {1989},
    addendum = {{Original} work published 1962}
}

如果您不想手动使用addendum,您可以自己制作biblatex/biber进行映射。

只需将其添加到序言中即可。

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=note, final]
      \step[fieldset=addendum, origfieldval, final]
      \step[fieldset=note, null]
    }
  }
}

它会将该note字段复制到该addendum字段中(仅当后者为空时),note之后该字段将被删除。

然后您就可以note照常使用。


最不方便的方法是修改中定义的所有驱动程序apa.bbx。不幸的是,apa.bbx没有使用任何宏来打印noteaddendum,而是裸的\printfield{note}\printfield{addendum}

我们\DeclareBibliographyDriver{book}发现:

...
\printfield{series}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{location+publisher}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\setunit*{\addspace}\newblock
\usebibmacro{origyear}%
\newunit\newblock
\printfield{addendum}%
\newunit\newblock
...

您可以手动移动所有\printfield{note}附近\printfield{addendum}

...
\printfield{series}%
\newunit\newblock
\usebibmacro{location+publisher}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\setunit*{\addspace}\newblock
\usebibmacro{origyear}%
\newunit\newblock
\printfield{addendum}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
...

或者你可以xpatch通过

\xpatchbibdriver{book}
  {\newunit\newblock
   \printfield{note}%
  }
  {}%
  {\typeout{successfully temporarily removed note}}
  {\typeout{failed to temporarily remove note}}

\xpatchbibdriver{book}
  {\printfield{addendum}%
  }
  {\printfield{addendum}%
   \newunit\newblock
   \printfield{note}}%
  {\typeout{successfully re-added note after addendum}}
  {\typeout{failed re-add note after addendum}}

不过,你必须对所有驱动程序都执行此操作。因此,你可能希望将其包装到命令中

\newcommand{\movenote}[1]{%
  \xpatchbibdriver{#1}
    {\newunit\newblock
     \printfield{note}}
    {}%
    {\typeout{successfully temporarily removed note (in driver #1)}}
    {\typeout{failed to temporarily remove note  (in driver #1)}}%
  \xpatchbibdriver{#1}
    {\printfield{addendum}}
    {\printfield{addendum}%
     \newunit\newblock
     \printfield{note}}%
    {\typeout{successfully re-added note after addendum  (in driver #1)}}
    {\typeout{failed re-add note after addendum  (in driver #1)}}%
}

要修补驱动程序,请使用\movenote{article},您可以对所有驱动程序调用此命令,如下所示:

\makeatletter
\forlistloop{\movenote}{\blx@datamodel@entrytypes}
\makeatother

或者

\makeatletter
\def\do#1{\movenote{#1}}
\abx@doentrytypes
\makeatother

相关内容