[Tex/LaTex] biblatex + \mcite; add arbitrary text in references with subentries

biblatexbiblatex-chemcitingnotes

In chemistry it's quite common to add prefixes to bibitems or even add notes to the references. See some example in literature to give you a hint what I mean. It is not created with LaTeX!

I've fiddled around with biblatex + biber and the \mcite and \bibnote comand, but came to no solution. I want to add some text in certain references with subentries before the bibitem.

I created this MWE:

\documentclass[english]{article}
\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß},Euro={€}}
\usepackage{babel}
\usepackage[T1]{fontenc}

\usepackage[%
  citestyle=numeric-comp,
  bibstyle=chem-angew,
  sorting=none,
  backend=biber,
  mcite=true,
  subentry,
]{biblatex}
\usepackage{notes2bib}
\usepackage{filecontents}

\begin{filecontents}{example.bib}
@article{Boncella1984,
author = {Boncella, James M. and Andersen, Richard A.},
journal = {Inorg. Chem.},
pages = {432--437},
volume = {23},
year = {1984}
}

@article{Tilley1982,
author = {Tilley, T. Don and Andersen, Richard},
journal = {J. Am. Chem. Soc.},
pages = {1772--1774},
volume = {104},
year = {1982}
}
\end{filecontents}

\addbibresource{example.bib} 

\begin{document}
\section{sec1}

This is some nice text I want to cite.\mcite{set1,*Boncella1984,*Tilley1982}
I want to add this note in references.\bibnote{test note}
Here I cite a single paper from the previous set.\cite{Tilley1982} This is how it should look like with included note.\bibnote{See, for example: \fullcite{set1}}

\printbibliography
\end{document} 

I'm fine with the subentries how they're created in ref 1 by:

\mcite{set1,*Boncella1984,*Tilley1982}

and with citing members of the set by referencing just one key from the predefined set1:

 \cite{Tilley1982}

I'm also fine with notes which I can add to references section like in ref 2 by:

\bibnote{test note}

But I also need to add some text before the bibitem in a certain reference. This should look like in ref 3. However,

\bibnote{See, for example: \fullcite{set1}}

gives me only an endnote followed by a copy of ref 1. This is not applicable as I have to define set1 with \mcite before, which results of course in 2 referneces. Ref 3 is only for demonstration how it should look like. I'm not able to get a single reference which looks like ref 3. Something like

\bibnote{See, for example:\mcite{set1,*Boncella1984,*Tilley1982}}

doesn't work. It gives me 2 references.

How can I create a reference with text followed by subentries? I also want to have the opportunity to cite single members of the set elsewhere, like in ref 1b.

Edit 1:

This is some nice text I want to cite.\bibnote{some added text:\mcite{set1,*Boncella1984,*Tilley1982}}
I want to add this note in references.\bibnote{test note}
Here I cite a single paper from the previous set.\cite{Tilley1982} This is how it should look like with included note.\bibnote{more added text: \fullcite{set1}}

gives me the following:

\bibnote{some added text:\mcite{set1,*Boncella1984,*Tilley1982}}

just adds the text followed by reference in brackets as you can see in ref 1 in the 2nd example. I just want to create a reference with subentries in which some text is followed by subentry (a). It should look like in ref 3. However, ref 3 is just constructed to give you the look. It can not be created as "stand alone" reference, only in combination with a second.

Edit 2:

as it seems still not clear. Apllying only this:

\begin{document}
\section{sec1}

This is some nice text I want to cite.\bibnote{some added text:\mcite{set1,*Boncella1984,*Tilley1982}}

\printbibliography
\end{document} 

gives me the following output:
enter image description here

in which 2 references are created instead of 1 desired and none looks the way I want it.

Edit 3:

Inspired by this question I created an example. However, the added note is of course after the corresponding bibitem as in the quoted question. How can I get the added notes before my bibitems, but still after the reference number [X]? I've got a huge document in which every chapter has its own references. Addition of notes seems to work, however not elegant. Since, my notes are work (chapter) related, I don't want to edit my *.bbl. However, the chosen way with loadfiles is not very elegant. But I'm still able to place my note in near of \cite commands. It would be not applicable to put all the notes in the preamble of the document or elsewhere.

To repeat my question: How can I get the added notes in front of my bibiem applying the \loadfiles option to have them look like ref 3 in above examples?

\documentclass[english]{article}
\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß},Euro={€}}
\usepackage{babel}
\usepackage[T1]{fontenc}

\usepackage[%
 citestyle=numeric-comp,
   bibstyle=chem-angew,
   sorting=none,
  backend=biber,
  mcite=true,
  subentry,
  loadfiles=true,
]{biblatex}
\usepackage{notes2bib}
\usepackage{filecontents}

\begin{filecontents}{example.bib}
@article{Boncella1984,
author = {Boncella, James M. and Andersen, Richard A.},
journal = {Inorg. Chem.},
pages = {432--437},
volume = {23},
year = {1984}
}

@article{Tilley1982,
author = {Tilley, T. Don and Andersen, Richard},
journal = {J. Am. Chem. Soc.},
pages = {1772--1774},
volume = {104},
year = {1982}
}
\end{filecontents}

\DeclareFieldFormat{annotation}{#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}}
}

\addbibresource{example.bib} 

\begin{document}
\section{sec1}
\begin{refsection}
This is some text I want to cite.\mcite{set1,*Boncella1984,*Tilley1982}
\begin{filecontents}{notes/note-set1.tex}
hello world
\endinput
\end{filecontents}
\printbibliography
\end{refsection}

\section{sec2}
\begin{refsection}

This is even more text I want to cite.\mcite{set2,*Boncella1984,*Tilley1982}

\begin{filecontents}{notes/note-set2.tex}
hello again
\endinput
\end{filecontents}
\printbibliography
\end{refsection}
\end{document}

enter image description here

Best Answer

Updated

As I understand it, you want to be able to add a note which will be printed at the start of a bibliographical entry (consistently with the use in your field where the bibliography seems to include material which might, in other fields, appear in footnotes or endnotes).

I've had various tries at this during the course of today, getting somewhat closer each time. I think the best solution is probably along these lines:

  1. We define a command \prenotation{key}{text} which writes to the .aux file. The reason for doing it this way is that we need to use \AtEveryBibitem, which can only be used in the preamble; but its inconvenient to have to give all these notations in the preamble (though it would work).

  2. What actually gets written to the .aux file is an internal command which sets up a check that is made at every bibitem. This could slow things down if you have lots of these notes, but I'm assuming that will not be a problem. I've refined the check so that if by any chance a given key gets used more than once (as it might if there are multiple bibliographies) the note gets printed only on the first occasion.

  3. We then need some housekeeping to undefine this internal command (or,rather, to castrate it) so that we don't try to use \AtEveryBibitem when the .aux file gets read in again at the end.

\documentclass[english]{article}
\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß},Euro={€}}
\usepackage{babel}
\usepackage[T1]{fontenc}

\usepackage[%
 citestyle=numeric-comp,
   bibstyle=chem-angew,
   sorting=none,
  backend=biber,
  mcite=true,
  subentry,
  loadfiles=true,
]{biblatex}
\usepackage{notes2bib}
\usepackage{filecontents}

\begin{filecontents}{example.bib}
@article{Boncella1984,
author = {Boncella, James M. and Andersen, Richard A.},
journal = {Inorg. Chem.},
pages = {432--437},
volume = {23},
year = {1984}
}

@article{Tilley1982,
author = {Tilley, T. Don and Andersen, Richard},
journal = {J. Am. Chem. Soc.},
pages = {1772--1774},
volume = {104},
year = {1982}
}
\end{filecontents}

\makeatletter
\newcommand{\prenotation}[2]{%
  \write\@mainaux{\noexpand\bl@makeprenotation{#1}{#2}}}
\newcommand{\bl@makeprenotation}[2]{%
  \AtEveryBibitem{%
    \ifcsdef{bl@prenote#1}
      {}
      {\iffieldequalstr{entrykey}{#1}
         {\expandafter\gdef\csname bl@prenote#1\endcsname{}%
          #2}
         {}}}}
\AtBeginDocument{\let\bl@makeprenotation\@gobbletwo}
\makeatother

\addbibresource{example.bib} 

\begin{document}

\section{sec1}
\begin{refsection}
This is some text I want to cite.\mcite{set1,*Tilley1982,*Boncella1984}
\prenotation{set1}{Here is an introductory text for set 1: }%

\printbibliography
\end{refsection}

\section{sec2}
\begin{refsection}

This is even more text I want to cite \mcite{set2,*Tilley1982,*Boncella1984}, with a note \bibnote{And here is a bibnote.}. 

\prenotation{set2}{Here is an introductory text for set 2: }%

\printbibliography
\end{refsection}
\end{document}

enter image description here