[Tex/LaTex] Notes after bibliography entry with Biber and biblatex

biberbiblatexnotes

I'm using biblatex with Biber as a backend. I need to add a one-sentence note, in bold, after a few of my references in the bibliography. These notes are not contained in my .bib file; they are specific to the paper I am currently working on. It has been suggested to me that I can just edit the .bbl file to include the note, but I'm not sure how to do this. Is this a viable solution? If so, how do I do it? If not, how can I achieve this in another way?

I'm using the nature citation style, if that makes a difference.

Best Answer

It is possible to insert additional material in a bbl generated by biber/BibLaTX combination. You can add

\field{mynote}{<TEXT OF THE NOTE>}

in the appropriate entries. The one has to give the instruction to print it. A possible way to insert at the end of a bibenty (and in bold) is:

\DeclareFieldFormat{mynote}{\textbf{#1}}
\AtEveryBibitem{
\csappto{blx@bbx@\thefield{entrytype}}{\iffieldundef{mynote}{}{\par\printfield{mynote}}}
}

Successive calls to biber will erase the modifications in the bbl file.

An alternative is to use bibexport to create a new BibTeX file containing only the entries in the current tex file, and then using the file generated by bibexport and inserting the notes specific to the paper there.

A further alternative is to use BibLaTeX facilities for external files. For this the option loadfiles has to be explicitly activated

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=nature,loadfiles=true]{biblatex}
\addbibresource{\jobname.bib}
\begin{filecontents}{\jobname.bib}
@article{key1,
author = {Author, John},
title  = {Title},
journal =  {A Journal},
year = 2012,
}
@article{key2,
author = {Author2, John},
title  = {Title},
journal =  {A Journal},
year = 2012,
}
\end{filecontents}

\begin{filecontents}{Notes/note-key2.tex}
Note for \cite{key2}.  
\endinput
\end{filecontents}

\DeclareFieldFormat{annotation}{\textbf{#1}}
\renewbibmacro*{annotation}{
  \IfFileExists{Notes/note-\thefield{entrykey}.tex}{\par}{}
  \printfile[annotation]{Notes/note-\thefield{entrykey}.tex}
}

\AtEveryBibitem{
\csappto{blx@bbx@\thefield{entrytype}}{\usebibmacro{annotation}}
}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

Notes: Here I use a Notes directory that must be created before compiling the file. For the note files one can decide to use filecontents to include them in the main source file or to generate independently only one time.

Related Question