[Tex/LaTex] Add Text/Comment into bibliography

biblatex

I am using an additional bibliography inside my thesis. This includes only articles to which I contributed. Displaying these works fine, but I would like to add some comment before each cited paper. My code so far looks like this:

\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}

This adds paper 2 and 3 to the bibliography, but I cannot enter a comment above it.
I made a short visualization what I am trying to get:

enter image description here

This piece of code from this tex.sx article adds a comment to the bibliography.

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

But how can I add the commment before the entry (as indicated by the arrows in the image above)?

Best Answer

There are two issues with adding a "note" before every item. The first issue is getting the "note" and the second issue is printing the note.

Using the bibtex8 backend for biblatex constrains the fields that can be used in your bib file. For this application, you would probably want to use the note field, although this will cause problems for any entries that need the note field to carry extra information. If you can use biber as the backend then you can define your own fields and data model.

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

and then you do not have to worry about clashes.

Printing the note before the entry is easier than after the entry since there is the \AtEveryBibitem hook. The only trick is that the bibliography is in a list environment so you need an \item and not a \par after the note. You also need to clear the note field so it is not used later. You can add the note with

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

A full 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}

enter image description here