# Separate multiple bib files reference using biblatex

I have two .bib files and I can't seem to simply display each bibliography separate. I have searched on several forums but either I can't get the proposed solutions to work or they are quickly very complicated. I was just also imagining something like this or this but I can't get it to work. What is missing? Thanks.

\documentclass{article}

\usepackage{biblatex}

\begin{document}

\nocite{*}
\printbibliography[title={first bibliography}, resetnumbers=true]
\printbibliography[title={second bibliography}, resetnumbers=true]

\end{document}

• Welcome to TeX.SE. From your links tex.stackexchange.com/questions/135952/… seems the most relevant. Could you explain what you mean exactly with "I can't get it to work"? Do you get errors? If yes, which errors? No output? Wrong output? If the output is wrong, then what does the output look like? May 7 '21 at 16:30
• This is usually done by adding keywords via a Biber sourcemap, see the end of the accepted answer to tex.stackexchange.com/q/35279/35864 May 8 '21 at 11:26

Something like this should work:

\documentclass{article}

\usepackage{biblatex}

\begin{document}

\begin{refsection}[bib1]
\nocite{*}
\printbibliography[title={first bibliography}, resetnumbers=true]
\end{refsection}
\begin{refsection}[bib2]
\nocite{*}
\printbibliography[title={second bibliography}, resetnumbers=true]
\end{refsection}

\end{document}


biblatex already lets you filter by lots of properties, but not by file name of the containing .bib file.

If the crucial property that separates the two bibliographies can be read off from the data, it might be possible to code a solution that does not need to rely on the artificial separation into different files.

Still, biblatex: multiple bibliographies categorised by different .bib files explains how you can separate your bibliographies just by reference to the file names with a Biber sourcemap. The following just uses the new appendstrict feature to avoid clashes with existing noneempty keywords fields.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

\DeclareSourcemap{
\maps[datatype=bibtex, overwrite]{
\map{
\perdatasource{bib1.bib}
\step[fieldset=keywords, fieldvalue={, }, appendstrict]
\step[fieldset=keywords, fieldvalue=one, append]
}
\map{
\perdatasource{bib2.bib}
\step[fieldset=keywords, fieldvalue={, }, appendstrict]
\step[fieldset=keywords, fieldvalue=two, append]
}
}
}

\begin{filecontents}{bib1.bib}
@article{sigfridsson,
author       = {Sigfridsson, Emma and Ryde, Ulf},
title        = {Comparison of methods for deriving atomic charges from the
electrostatic potential and moments},
journaltitle = {Journal of Computational Chemistry},
date         = 1998,
volume       = 19,
number       = 4,
pages        = {377-395},
doi          = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
\end{filecontents}
\begin{filecontents}{bib2.bib}
@book{nussbaum,
author       = {Nussbaum, Martha},
title        = {Aristotle's \mkbibquote{De Motu Animalium}},
date         = 1978,
publisher    = {Princeton University Press},
location     = {Princeton},
keywords     = {anotherkey},
}
\end{filecontents}