The biblatex package offers great flexibility while creating bibliographies. One of the things the package handles beautifully and can be achieved with little effort is the subdivision of a bibliography into multiple parts for per chapter/section bibliographies as well as by type or other patterns.
Per chapter/section bibliographies
Biblatex implements the refsection
environment to collect all citation for a chapter or section and print them at end of a chapter, section or document. Here is an example for section-wise bibliographies. It works similarly for chapters. The following code illustrates how to use the refsection
environment.
% Preamble \usepackage[sorting=none, backend=biber]{biblatex} % load the package \addbibresource{references.bib} % add a bib-reference file % Document \section{First} \begin{refsection} % refsection environment Citation section \thesection: \cite{knuth1986texbook} % collect citations \printbibliography[heading=subbibliography] % print section bibliography \end{refsection}
The following screenshot was taken from the PDF output of the complete minimal working example below. It generates section-wise bibliographies.
\documentclass{article} \usepackage[sorting=none, backend=biber]{biblatex} \usepackage{filecontents} \begin{filecontents}{references.bib} @book{knuth1986texbook, keywords = {book}, title={The texbook}, author={Knuth, D.E. and Bibby, D.}, volume={1993}, year={1986}, publisher={Addison-Wesley} } @article{knuth1977fast, keywords = {article}, title={Fast pattern matching in strings}, author={Knuth, D.E. and Morris Jr, J.H. and Pratt, V.R.}, journal={SIAM journal on computing}, volume={6}, number={2}, pages={323--350}, year={1977}, publisher={SIAM} } \end{filecontents} \addbibresource{references.bib} \begin{document} \section{First} \begin{refsection} Citation section \thesection: \cite{knuth1986texbook} \printbibliography[heading=subbibliography] \end{refsection} \section{Second} \begin{refsection} Citation section \thesection: \cite{knuth1977fast} \printbibliography[heading=subbibliography] \end{refsection} \end{document}
The biblatex package documentation has examples on how to insert bibliographies for every chapter at the end of the document.
Type-/keyword-specific bibliographies
Subdividing the bibliography by bib-entry type (book, article, online, etc.) or by keywords is handled slightly differently by the package, but fortunately, the solution is similarly simple.
Subdividing by bib-entry type
The \printbibliography
command takes the optional argument type
, defining bib-types to include and nottype
, defining bib-types to exclude. Multiple bib-entry types can be combined for inclusion and exclusion. Suppose, for example, we would like to have three bibliographies, one for books, one for articles, and one for the everything else:
\printbibliography[title={Book references},type=book] \printbibliography[title={Article references},type=article] \printbibliography[title={Other references}, nottype=article, nottype=book]
In the following example, I am using three references by Donald E. Knuth, a book, an article and an inproceedings type.
\documentclass{report} \usepackage[sorting=none, backend=biber]{biblatex} \usepackage{filecontents} \begin{filecontents}{references.bib} @book{knuth1986texbook, title={The texbook}, author={Knuth, D.E. and Bibby, D.}, volume={1993}, year={1986}, publisher={Addison-Wesley} } @article{knuth1977fast, title={Fast pattern matching in strings}, author={Knuth, D.E. and Morris Jr, J.H. and Pratt, V.R.}, journal={SIAM journal on computing}, volume={6}, number={2}, pages={323--350}, year={1977}, publisher={SIAM} } @inproceedings{knuth1970simple, title={Simple word problems in universal algebras}, author={Knuth, D.E. and Bendix, P.B.}, booktitle={Computational problems in abstract algebra}, volume={263}, pages={297}, year={1970} } \end{filecontents} \addbibresource{references.bib} \begin{document} See \cite{knuth1986texbook} and \cite{knuth1977fast} and \cite{knuth1970simple}. \printbibliography[title={Book references},type=book] \printbibliography[title={Article references},type=article] \printbibliography[title={Other references}, nottype=book, nottype=article] \end{document}
Subdividing by keywords
In case you intend to subdivide your bibliography by another pattern than type, you may use the “keywords”-field of bib-entries for subdivision. For example, to subdivide the bibliography into “own” and other references, use the keyword “own” for each of your own publication.
article{texblog2012, keywords = {own}, % keyword for subdivided bibliography title={My fancy publication}, author={Texblog, T}, journal={TUGboat}, volume={33}, number={3}, pages={1001--1002}, year={2012}, }
\printbibliography[keyword=own,...] \printbibliography[notkeyword=own,...]
By the way, TUGboat is the TeX Users Group journal. I made the publication up.
There are other ways to subdivide the bibliography of a document into several parts. See the package documentation or drop me a comment below if you have a question related to the topic.
jgrigera
Nice post about biblatex, thank you. It does seem to lack one caveat: when using these features you need to use biber as backend (and dump bibtex to the dustbin of history where it might belong). Replacing bibtex needs a bit of tweaking: biber bib styles are written in latex and not lisp, and you might need to tweak your favorite latex editor.
tom
Thanks for your comment. I totally agree. Sometimes, I focus too much on the details and don’t see the essential.
In TeXShop for example, open Preferences and choose the “Engine” tab. Replace “BibTeX Engine” default (
bibtex
) bybiber
.Cheers, Tom.
Preetham Aghalaya Manjunatha
Dear Tom,
Thank you very much for your crisp example. I tried to run the
…
But unfortunately I am getting no bibliography output,
The error message is
LaTeX Warning: Citation ‘knuth1986texbook’ on page 1 undefined on input line 29
LaTeX Warning: Empty bibliography on input line 30.
LaTeX Warning: Citation ‘knuth1977fast’ on page 1 undefined on input line 34.
LaTeX Warning: Empty bibliography on input line 35.
I am using Mac OS, Lion
Tex Live Utility: Version 1.12 (1.12) biber, biblatex installed
Tex Shop: Version 2.47 (2.47)
Also, I have used Tex Maker 3.5.2. Changed backend=biber to backend=bibtex, no luck.
Would you please help me on this.
Thank you,
tom
Hi!
Thanks for your question. I removed the code, since it was the example from the post. You need to run:
latex
,biber/bibtex
,latex
, (latex
). I suspect, you only ranlatex
, which is why you get these warnings. I’m not familiar with TeXMaker, but there should be a way to runbiber/bibtex
from within the editor.HTH,
Tom
Bunya
Dear Tom,
I have the same problem as Preetham Aghalaya Manjunatha. I could not find a way to solve it yet.
here is my code:
I use TexStudio(MiKTeX 2.9 64-bit). In the end I would actually use \input or \include in order to add each chapter to the main code. I tried many different ways, but it did not work for me. It would be great if you could help. Thank you
tom
Hi Bunya,
Thanks for getting in touch.
The short answer is to use
backend=biber
instead. If you have to usebibtex
, producing bibliographies for each section requires extra effort explained here.HTH, Tom
Preetham Aghalaya Manjunatha
Thanks tom it worked. I have made a quick text for build. It includes pdflatex, make index, bib(la)tex, pdflatex again. Here it is:
% Quick Build Config (BibLaTeX)
%”/usr/texbin/pdflatex” -synctex=1 -interaction=nonstopmode %.tex|”/usr/texbin/biber” %.bcf|”/usr/texbin/makeindex” -s %.ist %.idx|”/usr/texbin/pdflatex” -synctex=1 -interaction=nonstopmode %.tex|”/usr/texbin/pdflatex” -synctex=1 -interaction=nonstopmode %.tex|open %.pdf
% Quick Build Config (BibTeX)
%”/usr/texbin/pdflatex” -synctex=1 -interaction=nonstopmode %.tex|”/usr/texbin/bibtex” %.aux|”/usr/texbin/makeindex” -s %.ist %.idx|”/usr/texbin/pdflatex” -synctex=1 -interaction=nonstopmode %.tex|”/usr/texbin/pdflatex” -synctex=1 -interaction=nonstopmode %.tex|open %.pdf
tom
Thanks! Cheers, Tom.
Mori
Hello,
I have a problem with the reference numbering. I am using the following comments in my Ref-Doc. bib page, and after compiling the project, the reference numbers from the list of figures and tables not from the text itself, since I have citation in the figure and tables’ captions.
Is there any way to eliminate this issue and start the numbering from the first chapter of the texts.
Thank you,
tom
Hi Mori,
Thanks for your comment. I’m not sure I understand your problem. Is the code LaTeX? What package do you use? For citations in captions, see this related question.
HTH, Tom
Mathieu
Hi Tom,
Thanks for this code, it really help. But for my thesis I need to use the APA norms for bibliography. Nevertheless, when using
\usepackage{apacite} or \usepackage{natbib}
\bibliographystyle{apacite}
It does not work and say that the package is not compatible. Could you help me on that please ? Thank you.
Mathieu.
tom
Hi Mathieu,
Thanks for your question. You can load both packages, but you will have to load
apacite
first with thenatbibapa
option:See the discussion here for more details on the topic.
Best, Tom