Automatically split sources list into bibliography and references

I am currently reading up on how to properly format used resources. Doing so I found out it is customary to distinguish between references and bibliography, the former being the list of sources actually referenced in the text, like

This was finding was made by Smith (2008)

and the latter being a list of materials used by the author that are not directly referenced in the text.

I would like to achieve this format with biblatex. Consider the following example

main.tex:

\documentclass{article}

\usepackage[american]{babel}
\usepackage[backend=biber, bibencoding=utf8, style=apa, natbib=true]{biblatex}

\DeclareLanguageMapping{american}{american-apa}

\begin{document}

A discussion of the subject can be found in \citet{Smith08}.
\nocite{Baker10}

\printbibliography[]

\end{document}


sample.bib:

@book{Smith08,
author = {Smith, E.},
year = {2008},
title = {The other book},
}

@book{Baker10,
author = {Baker, M.},
year = {2010},
title = {The book},
}


I would like the sources list generated to look like this, as Baker (2010) was not directly referenced but Smith (2008) was:

Bibliography

Baker, M. (2010). The book.

References

Smith, E. (2008). The other book.

I suspect this can be done with \DeclareBibliographyCategory somehow, but I can't figure out how.

But maybe there is even a better way as this seems like a standard format.

• Jun 11 '19 at 4:49
• With a recent version of biblatex (>= 3.8) and biblatex-apa (>= 7.5) [both released around November 2017; Overleaf has an older version], you don't need the \DeclareLanguageMapping{american}{american-apa}. Jun 11 '19 at 5:59

You can split your bibliography and then append keywords to identify different bibliography entries. A MWE:

    \documentclass{article}

\usepackage[american]{babel}
\usepackage[backend=biber, bibencoding=utf8, style=apa, natbib=true]{biblatex}

\DeclareLanguageMapping{american}{american-apa}

\usepackage{filecontents}

\begin{filecontents}{biblatextest1.bib}
@book{Baker10,
author = {Baker, M.},
year = {2010},
title = {The book},
}
\end{filecontents}
%
\begin{filecontents}{biblatextest2.bib}
@book{Smith08,
author = {Smith, E.},
year = {2008},
title = {The other book},
}
\end{filecontents}

%Append keywords to identify different bibliography entries.
\DeclareSourcemap{
\maps[datatype=bibtex, overwrite]{
\map{
\perdatasource{biblatextest1.bib}
\step[fieldset=KEYWORDS, fieldvalue=primary, append]
}
\map{
\perdatasource{biblatextest2.bib}
\step[fieldset=KEYWORDS, fieldvalue=secondary, append]
}
}
}
\begin{document}

A discussion of the subject can be found in \cite{Smith08}.
\nocite{Baker10}

\printbibliography[title=Bibliography, keyword=primary]
\printbibliography[title=References, keyword=secondary]

\end{document}


With only a bib source declaring a category:

\documentclass{article}

\usepackage[american]{babel}
\usepackage[backend=biber, bibencoding=utf8, style=apa, natbib=true]{biblatex}

\DeclareLanguageMapping{american}{american-apa}

\usepackage{filecontents}

\begin{filecontents}{biblatextest.bib}
@book{Baker10,
author = {Baker, M.},
year = {2010},
title = {The book},
}
@book{Smith08,
author = {Smith, E.},
year = {2008},
title = {The other book},
}
\end{filecontents}

\DeclareBibliographyCategory{cited}

\begin{document}

A discussion of the subject can be found in \cite{Smith08}.
\nocite{Baker10}

\printbibliography[title=Bibliography,notcategory=cited]
\printbibliography[title=References,category=cited]

\end{document}


• Ok, cool. But there is no better way? This looks like a lot of hassle with many sources. I imagined there might be a solution based on whether the source was called with a variant of \cite versus \nocite, as \cite means the source was referenced and \nocite means it was not referenced. Jun 10 '19 at 22:32
• @ lo tolmencre, see my edited answer
– Ñako
Jun 10 '19 at 22:59
• Great, exactly what I had in mind. Thanks! Jun 10 '19 at 23:04
• I've just implemented this (the first part of your answer) in my document; thank you for this solution. Something I've noticed is that citations in the .bib file that include the keywords term do not display in the printed bibliography list; it appears the use of keywords as filtering is incompatible with the keywords metadata term - not that I've ever needed that term anyway. Oct 28 '20 at 8:20