1

I would like to print the remaining entries in a .bib file using biblatex, that is, I have a large set of entries which I print at several places throughout a document using various calls to \printbibliography, and then I want to end by printing whatever references that have not yet been printed. The desired solution should not depend on the .bib entries themselves, that is, the whole point is not to have to go through the entries and add keywords or similar.

My current non-working solution uses \AtEveryBibitem to put printed entries in a category to be able to print all entries that are not yet in this category. This strategy of course works only halfway, though, since it ends up in an oscillation where the uncategorized entries ends up in the category every second time since \AtEveryBibItem is also run for these entries when they are printed (so if the \AtEveryBibitem statement can in some way be reset before the last call to \printbibliography that would be a solution).

MWE:

\documentclass{article}

\usepackage{biblatex}

\begin{filecontents}{mybib.bib}
@article{ref1,
  author    = {Guyon, Isabelle and Elisseeff, Andr\'{e}},
  journal   = {The Journal of Machine Learning Research},
  pages     = {1157--1182},
  title     = {{An introduction to variable and feature selection}},
  volume    = {3},
  year      = {2003}
}
@book{ref2,
  author    = {Michel Goossens and Frank Mittelbach and Alexander Samarin},
  title     = {The LaTeX Companion},
  year      = {1993},
  publisher = {Addison-Wesley},
  address   = {Reading, Massachusetts}
}
@inproceedings{ref3,
  author    = {Conf Author},
  title     = {Conf Title},
  year      = {2040},
  keywords  = {confpaper}
}
\end{filecontents}

\addbibresource{mybib.bib}

\DeclareBibliographyCategory{printed}
\AtEveryBibitem{\addtocategory{printed}{\thefield{entrykey}}}

\begin{document}

\nocite{*} % The .bib file contains several hundreds of entries

\printbibliography[title={Journal articles},type=article]
\printbibliography[title={Conference papers},keyword=confpaper]
% Many other bibliographies are printed using various \printbibliography statements

% And now the entries that have never been printed should be printed
\printbibliography[title={Uncategorized},notcategory=printed]

\end{document}

1 Answer 1

1

Using \AtEveryBibitem does not work since in biblatex the \bibitems are loaded at the beginning of a document and not when a list of references is printed (e.g., \printbibliography). An alternative is to add a hook to the instruction for printing the records. An option is to insert the information about the category in the finentry bib macro that is called at the end of the instructions to display a bib record. In addition we can add toggle to turn off the feature when we print the other bib records.

\newtoggle{categorise} % load the etoolbox package, \usepackage{etoolbox} 

\DeclareBibliographyCategory{printed}

\renewbibmacro{finentry}{%
  \iftoggle{categorise}
    {\addtocategory{printed}{\thefield{entrykey}}
    {}
    }%
    \finentry
  }

then

\nocite{*} % The .bib file contains several hundreds of entries

\toggletrue{categorise}
\printbibliography[title={Journal articles},type=article]
\printbibliography[title={Conference papers},keyword=confpaper]
% Many other bibliographies are printed using various \printbibliography statements


% And now the entries that have never been printed should be printed
\togglefalse{categorise}
\printbibliography[title={Uncategorized},notcategory=printed]

With the MWE this yields

enter image description here

3
  • Not the desired answer... The desired solution should simply print whatever has not yet been printed. The \printbibliography statement examples were simply examples, so a solution should not depend on certain types or keywords (I modified the second \printbibliography-statement and added a keyword to one of the entries to exemplify).
    – bolakin298
    Commented Feb 14, 2021 at 20:57
  • You can modify the filter by adding the negation of the conditions in the various \printbibliographys.
    – Guido
    Commented Feb 14, 2021 at 21:17
  • Works perfect apart from one thing: adding more references under each heading makes a dot and a space, ". ", appear before the label, that is, adding a second conference paper turns the output label into ". [2]". The problem seems to be that the parentheses in the \iftoggle-statement are mismatched so that \finentry is only run for the \togglefalse case.
    – bolakin298
    Commented Feb 16, 2021 at 23:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .