在参考书目中添加文本/评论

在参考书目中添加文本/评论

我在论文中使用了附加书目。这仅包括我参与撰写的文章。显示这些内容效果很好,但我想在每篇引用的论文前添加一些注释。到目前为止,我的代码如下所示:

\documentclass{scrreprt}
\usepackage[bibstyle=authoryear, backend=bibtex8]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{jobname.bib}
@misc{A2011,
  author = {Author, A.},
  year = {2011},
  title = {A short title.},      
}
@misc{A2012,
  author = {Buthor, B.},
  year = {2012},
  title = {Systems biology and personalized medicine are two emerging research areas, which promise to transform our health system.},
}
@misc{A2013,
  author = {Cuthor, C.},
  year = {2013},
  title = {This title is not so short.},
}
\end{filecontents}
\addbibresource{jobname.bib}

\begin{document}
\defbibnote{myprenote}{This thesis is based on the following original publications:}
\nocite{A2012, A2013}
\printbibliography[prenote=myprenote,title={List of original publications}]
\end{document}

这会将论文 2 和 3 添加到参考书目中,但我无法在其上方输入评论。我对我想要获得的内容进行了简短的可视化:

在此处输入图片描述

这段代码来自tex.sx 文章在参考书目中添加了一条评论。

\DeclareDatamodelFields[type=field,datatype=literal]{mynote}
\usepackage{xpatch}
\xapptobibmacro{finentry}{\par\printfield{mynote}}{}{}

但是我如何在条目前添加注释(如上图中箭头所示)?

答案1

在每个项目前添加“注释”有两个问题。第一个问题是获取“注释”,第二个问题是打印注释。

使用bibtex8后端会biblatex限制 bib 文件中可以使用的字段。对于此应用程序,您可能希望使用该note字段,尽管这会给需要注释字段来携带额外信息的任何条目带来问题。如果您可以使用biber作为后端,那么您可以定义自己的字段和数据模型。

\DeclareDatamodelFields[type=field,datatype=literal]{mynote}

那么您就不必担心冲突。

在条目前打印注释比在条目后打印注释更容易,因为有钩子\AtEveryBibitem。唯一的技巧是参考书目处于列表环境中,因此注释后需要一个\item而不是\par。您还需要清除注释字段,以便以后不再使用。您可以使用

\AtEveryBibitem{\printfield{note}\clearfield{note}\item}

完整的 MWE

\documentclass{scrreprt}
\usepackage[bibstyle=authoryear, backend=bibtex8]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A2011,
  author = {Author, A.},
  year = {2011},
  title = {A short title.},      
  note = {This source is really interesting because it doesn't have a real title}
}
@misc{A2012,
  author = {Buthor, B.},
  year = {2012},
  title = {Systems biology and personalized medicine are two emerging research areas, which promise to transform our health system.},
  note = {This second source is also really interesting because it contains words}
}
@misc{A2013,
  author = {Cuthor, C.},
  year = {2013},
  title = {This title is not so short.},
  note = {This third source is not interesting}
}
\end{filecontents}
\addbibresource{\jobname.bib}


\AtEveryBibitem{\printfield{note}\clearfield{note}\item}
\begin{document}
\defbibnote{myprenote}{This thesis is based on the following original publications:}
\nocite{A2012, A2013}
\printbibliography[prenote=myprenote,title={List of original publications}]
\end{document}

在此处输入图片描述

相关内容