Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
2  
You can use \DeclareSourcemap to add a note filed to some bib-entries. –  Marco Daniel Nov 16 '12 at 21:09

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
This works brilliantly, thanks! –  user1129889 Nov 17 '12 at 15:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.