3

I'm working on an annotated bibliography project. I have one bib file and need two bibliographies: one sorted chronologically, and the other sorted alphabetically. I want both bibliographies to include all the bib entries in my bib file. Moreover, in the bib file, each entry has a NOTE field which contains a summary of the paper/book. In the chronological bibliography, the NOTE fields are printed, but I don't want to have them twice and so they are not printed in the alphabetical bibliography. I am only allowed to use biblatex (not bibtex, amsrefs, etc.) due to other restrictions on the project. (EDIT: it seems we can use other fields other than NOTE [such as ANNOTE] for writing the summaries.)

I have two problems:

  1. I don't know how to manage the labels for the alphabetical bibliography. I've used labelprefix=A to get reference labels like [A1] to avoid confusion with labels like [1] in the first bibliography. However, this causes a funny situation. In the NOTE field of the entries in the first bibliography, we list the cited papers in the entry. We want to see something like [2, 4], but now it looks like [A2, 4] (this is only happening to some of the references), see the image. Another solution would be to have the labels of the second bibliography be numbers, but each entry gets the same number as in the first bibliography. This way, there is one reference number for each entry and there will be no problem. I saw some examples for handling similar situations with refsection or refsegment but I couldn't make it work. Any help/suggestions would be appreciated.

  2. I have manually defined a \myspace command to make the spacing in the NOTE field look pretty in the output. In particular, I have used this command at the beginning of the NOTE field for all the entries. Also, some of the notes which are longer have been split into paragraphs and \myspace is put between any two paragraphs. Is there any way to do this automatically (or in a more professional way)?

MWE:

ABCPNT.tex:

\documentclass{amsart}
\usepackage{blindtext}
\usepackage[sorting=ynt, backend=biber, datamodel=mrnumber, style=numeric-comp, sortcites]{biblatex}
\usepackage[colorlinks=true, pdfstartview=FitH, linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}

\addbibresource{ABCPNT.bib}  % File given below
\setlength\bibitemsep{0.2cm} % Space between references
\newcommand{\myspace}{\vspace*{0.3cm}\newline} % Space before/inside the NOTE field
\newbool{killnote} \AtEveryBibitem{\ifbool{killnote}{\clearfield{note}}{}} % To suppress the NOTE field in the second bibliography

\begin{document}
\nocite{*} % Include all the bib entries in bibliographies

\section{Chronological bibliography}
\printbibliography[heading=none] % The first bibliography, sorted by year

\section{Alphabetic bibliography}
\newrefcontext[sorting=nyt, labelprefix=A] % Change the sorting to name-year-title, adding a prefix A to the label of all entries
\booltrue{killnote} % Do not print the NOTE field in bib entires
\printbibliography[heading=none] % The second bibliography, sorted alphabetically
\end{document}

ABCPNT.bib

@article {ref1,
    AUTHOR = {Chebyshev, P.},
    TITLE = {{Lettre de M. le professeur Tchebychev a M. Fuss, sur un nouveau th{e}oreme relatif aux nombres premiers contenus dans la formes $4n+1$ et $4n+3$.}},
    FJOURNAL = {Bull. de la Classe phys. math. de l'Acad. Imp. des Sciences St. Petersburg},
    VOLUME = {11},
    YEAR = {1853},
    LANGUAGE = {French},
    NOTE = {\myspace Chebyshev's paper which was the starting point of the subject.},
}
%%%-------------------------------------------------------------------------------
@article{ref2,
    AUTHOR = {Phragmen, P.},
    TITLE = {{Sur le logarithme integral et la fonction $f(x)$ de Riemann}},
    YEAR  = {1891},
    FJOURNAL = {\"{O}fversigt af Kongl. Vetenskaps--Akademiens F\"{o}handlingar.},
    LANGUAGE = {French},
    VOLUME = {48},
    NOTE = {\myspace \blindtext \myspace This article cites~\cites{ref4, ref5}.},
}
%%%-------------------------------------------------------------------------------
@article{ref3,
    AUTHOR = {Landau, E.},
    TITLE = {{U}ber einen {S}atz von {T}schebyschef},
    JOURNAL = {Math. Ann.},
    FJOURNAL = {Mathematische Annalen},
    VOLUME = {61},
    YEAR = {1906},
    NUMBER = {4},
}
%%%-------------------------------------------------------------------------------
@article{ref4,
    author={Littlewood, J. E. },
    title={{Sur la distribution des nombres premiers}},
    year={1914},
    volume={158},
    journal={Comptes Rendus de l'Acad. Sci. Paris},
    language={French},
    note = {\myspace This article cites~\cites{ref4, ref5}.}
    }
%%%-------------------------------------------------------------------------------
@article{ref5,
    author={Hardy, G. H. and Littlewood, J. E. },
    title={{Contributions to the theory of the Riemann zeta-function and the theory of the distribution of primes}},
    year={1916},
    journal={Acta Math.},
    volume={41},
    number={1},
    note = {\myspace This article cites~\cites{ref1, ref4, ref3}.},
}

enter image description here

  • @GregMartin I voted to reject the edit because it removed the important piece of information that the note field is a must and can't be changed. – moewe Jul 11 at 6:04
  • In theory the citations should of course all start with A and the fact that they don't do that hint at an issue with the current implementation of refcontexts: github.com/plk/biblatex/issues/904. – moewe Jul 11 at 14:26
  • Re your second point: You can definitely automate the first \myspace and you can probably just separate paragraphs with \par (you can't use the usual blank line with Biber: tex.stackexchange.com/q/497673/35864) – moewe Jul 11 at 14:28
  • 1
    @moewe I appreciate your vote to reject the original edit (not knowing the offline relationship)—there are rules here after all :) – Greg Martin Jul 11 at 20:19
  • 1
    @moewe Your suggestions have been extremely helpful! We would like to add a note of acknowledgment to you in our annotated bibliography. What is your preference for how to refer to you in our acknowledgment? (My web page is on my profile—you can find my email there if you want to communicate privately.) – Greg Martin Jul 22 at 17:15
3

Since fields other than note are acceptable I suggest you use annotation instead. By default that field is not printed by most standard styles, but we can quickly change that.

As discussed in https://github.com/plk/biblatex/issues/904 the situation with the citations in the bibliography is a bit tricky. Usually I recommend not to use \cite in the bibliography to avoid these sort of issues. An explicit refcontext assignment (see MWE below \assignrefcontextentries) as suggested by PLK might help here.

The initial \myspace can be made redundant by issuing a \par (wrapped in \setunit) before printing the field contents. Within the field contents new paragraphs should be started with \par, using blank lines as usual in the rest of a .tex document will unfortunately not work. See Multiple paragraphs in bibliography fields via double line breaks and Preserve line breaks/newlines when parsing bib file with biber.

The redefinition of the bibliography environment was needed to be able to control the \parindent with \bibparindent.

\documentclass{amsart}
\usepackage{blindtext}
\usepackage[sorting=ynt, backend=biber, style=numeric-comp]{biblatex}
\usepackage{hyperref}

\assignrefcontextentries*[sorting=nyt, labelprefix=A]{*}

\newtoggle{showannotation}
\toggletrue{showannotation}

\renewbibmacro*{finentry}{%
  \iftoggle{showannotation}
    {\setunit{\par}%
     \printfield{annotation}}
    {}%
  \finentry}

\setlength{\bibitemsep}{.5\baselineskip}
\setlength{\bibparsep}{.5\bibitemsep}

\newlength{\bibparindent}
\setlength{\bibparindent}{0pt}

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{labelprefix}%
        \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}%
      \setlength{\listparindent}{\bibparindent}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article {ref1,
    AUTHOR = {Chebyshev, P.},
    TITLE = {{Lettre de M. le professeur Tchebychev a M. Fuss, sur un nouveau th{e}oreme relatif aux nombres premiers contenus dans la formes $4n+1$ et $4n+3$.}},
    FJOURNAL = {Bull. de la Classe phys. math. de l'Acad. Imp. des Sciences St. Petersburg},
    VOLUME = {11},
    YEAR = {1853},
    LANGUAGE = {french},
    annotation = {Chebyshev's paper which was the starting point of the subject.},
}
@article{ref2,
    AUTHOR = {Phragmen, P.},
    TITLE = {{Sur le logarithme integral et la fonction $f(x)$ de Riemann}},
    YEAR  = {1891},
    FJOURNAL = {\"{O}fversigt af Kongl. Vetenskaps--Akademiens F\"{o}handlingar.},
    LANGUAGE = {French},
    VOLUME = {48},
    annotation = {\blindtext \par This article cites~\cite{ref4, ref5}.},
}
@article{ref3,
    AUTHOR = {Landau, E.},
    TITLE = {{U}ber einen {S}atz von {T}schebyschef},
    JOURNAL = {Math. Ann.},
    FJOURNAL = {Mathematische Annalen},
    VOLUME = {61},
    YEAR = {1906},
    NUMBER = {4},
}
@article{ref4,
    author={Littlewood, J. E. },
    title={{Sur la distribution des nombres premiers}},
    year={1914},
    volume={158},
    journal={Comptes Rendus de l'Acad. Sci. Paris},
    language={French},
    annotation = {This article cites~\cite{ref4, ref5}.}
}
@article{ref5,
    author={Hardy, G. H. and Littlewood, J. E. },
    title={{Contributions to the theory of the Riemann zeta-function and the theory of the distribution of primes}},
    year={1916},
    journal={Acta Math.},
    volume={41},
    number={1},
    annotation = {This article cites~\cite{ref1, ref4, ref3}.},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}

\section{Chronological bibliography}
\printbibliography[heading=none]

\section{Alphabetic bibliography}
\togglefalse{showannotation}
\newrefcontext[sorting=nyt, labelprefix=A] 
\printbibliography[heading=none]
\end{document}

Two bibliographies

  • What is the benefit of using annotation instead of note? – Greg Martin Jul 11 at 21:00
  • 2
    @GregMartin It is semantically the better choice: According to the biblatex documentation annotation is supposed to be used for annotated bibliographies, whereas note holds "[m]iscellaneous bibliographic data which does not fit into any other field". Plus, note is not always the last field to be printed in the bibliography, which could mean that the comment is not the last part of the bibliography entry, which would look awkward. With annotation we had to decide for ourselves where to put it (at the end with finentry) so we can be sure it is really at the end. – moewe Jul 11 at 21:04
  • This is great, thanks! I'm busy today but I'll try your code on our project and let you know how it goes. Using annotation instead of note is in fact a brilliant idea; I remember I had to manually change the position of where the page field is printed because it was printed after the note field and made the PDF look awful. – Amir Hossein Jul 12 at 19:42
  • 1
    @AmirHossein Sure, replace \assignrefcontextentries*[sorting=nyt, labelprefix=A]{*} with \assignrefcontextentries*[sorting=ynt]{*}. – moewe Jul 13 at 4:12
  • 1
    ... If you are still having trouble I suggest you ask a new question with an MWE showing what you have tried and how it failed. – moewe Jul 17 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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