5

I have to add two different bibliographies to my thesis: One commented, which adds the comments above the paper and consists of my own publications and one general in the end, which contains all publications cited. Using the \AtEveryBibitem{\printfield{note}\clearfield{note}\item command (from this thread), I can read out the note field from the .bib and get the comment to the place where I need to have it.

The problem with this is, that my "standard" bibliography is build up from the records of the PubMed and contains notes for every entry. I don't want to display this notes in the normal bibliography, is there a way to show them in the "List of original publications" and suppress them in the normal bibliography?

My MWE 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.},
  note = {Some information from the journal}

}
@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 gives some additional information},
  keywords = {test}
}
@misc{A2013,
  author = {Cuthor, C.},
  year = {2013},
  title = {This title is short.},
  note = {This is a comment to this article.},
  keywords = {test}
}
@misc{C2000,
  author = {Duthor, D.},
  year = {2000},
  title = {Title for this reference.},
  note = {No further comment.}
}
\end{filecontents}
\addbibresource{jobname.bib}

%add the note field before each entry in the "Original Publications" bibliography
\AtEveryBibitem{\printfield{note}\clearfield{note}\item} 

\begin{document}
 \defbibnote{myprenote}{This thesis is based on the following original publications:}
 %\begin{refsection}
  \printbibliography[prenote=myprenote,title={List of original publications}, keyword=test]
 %\end{refsection}

 \section*{Test}
  This is a chapter to \textcite{A2011} and also cite some other publications \parencite{A2012, A2013, C2000}

  \printbibliography
\end{document}
Chris
  • 904
  • @StrongBad I ran into problems myself. Removing the the refsection allows to compile the code again, but than your answer will not work anymore. – Chris Feb 11 '14 at 20:12

1 Answers1

6

Since you want to conditionally print the note in some bibliographies and not other, a conditional seems to be the way to go

\newif\ifnoteRefSection
\AtEveryBibitem{\ifnoteRefSection\printfield{note}\item\fi\clearfield{note}}

You then need to turn turning the printing on/off before every \printbibliography

\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 = {Some information from the journal}

}
@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 gives some additional information},
  keywords = {test}
}
@misc{A2013,
  author = {Cuthor, C.},
  year = {2013},
  title = {This title is short.},
  note = {This is a comment to this article.},
  keywords = {test}
}
@misc{C2000,
  author = {Duthor, D.},
  year = {2000},
  title = {Title for this reference.},
  note = {No further comment.}
}
\end{filecontents}
\addbibresource{jobname.bib}

%add the note field before each entry in the "Original Publications" bibliography
\newif\ifnoteRefSection
\AtEveryBibitem{\ifnoteRefSection\printfield{note}\fi\clearfield{note}\item}
% \AtEveryBibitem{\printfield{note}\clearfield{note}\item} 

\begin{document}
 \defbibnote{myprenote}{This thesis is based on the following original publications:}
 %\begin{refsection}
  \noteRefSectiontrue
  \printbibliography[prenote=myprenote,title={List of original publications}, keyword=test]
 %\end{refsection}


 \section*{Test}
  This is a chapter to \textcite{A2011} and also cite some other publications \parencite{A2012, A2013, C2000}

  \noteRefSectionfalse
  \printbibliography
\end{document}
StrongBad
  • 20,495
  • Ah, thats clever, didn't knew that. There is one thing happening now: The main bibliography has a lot of empty lines between the entries. Why is that? When I delete the 'note' fields using \AtEveryBibitem{\clearfield{note}} this does not happen. – Chris Feb 11 '14 at 20:43
  • @Chris the extra lines come from the extra \item. You just need to move it inside the conditional (see the edited MWE). – StrongBad Feb 12 '14 at 09:23
  • This does not seem to be working on TL2019. No bcf file is generated by latex, and then running biber one gets: ERROR - Cannot find control file 't4.bcf'! - Did latex run successfully on your .tex file before you ran biber? – Paulo Ney Jun 01 '20 at 14:34