Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LaTeX: bibliography per chapter

Tags:

latex

bibtex

I am helping a colleague with his PhD thesis and we need to present the bibliography at the end of each chapter.

The question is: does anyone have a minimal working example for this case using latex+bibtex?

The current document structure that we use is the following:

main.tex chap1.tex chap2.tex ... chapn.tex biblio.bib 

Where main.tex contains packages, document declarations, macros and \includes for each chapter. biblio.bib is the only bibtex file (I think is easier to have all citations in one place).

We have searched and tried with different latex packages, reading and following their documentation. Specifically, bibitems and chapterbib.

bibitems successfully generates bu*.aux files, but when running bibtex for each one of them, an error occurs since there is no \bibdata element in the .aux file.

chapterbib also generates a .aux file, but bibtex finishes with an error caused by using multiple \bibliography{file} in the .tex files (one per chapter).

Some coworkers suggested using a separate bibtex file for each chapter, which could be a problem of maintenance in the future when citing the same publications in different chapters.

We will like to continue having this document structure, if possible. So, if anyone could shed some light to this problem, we will appreciate it.

Thanks.


Update: MWE found Thanks to Habi for the help, here is a working example:

With the document structure mentioned above:

% main.tex \documentclass{report} \usepackage{url} \usepackage{natbib} \usepackage{chapterbib}  \begin{document}  \include{chap1} \include{chap2} % other chapters ...  \end{document}  % chap1.tex \chapter{one chapter} text~\cite{paper1} text~\cite{paper2} % don't forget: \bibliographystyle{plainnat} \bibliography{biblio}  % chap2.tex \chapter{another chapter} text~\cite{paper2, paper3} % don't forget, again: \bibliographystyle{plainnat} \bibliography{biblio}  % biblio.bib @Article{paper1,   author =       {John Smith},   title =        {A title},   journal =      {A Journal},   year =         {2010} } @Article{paper2,   author =       {John Doe},   title =        {A paper},   journal =      {Another journal},   year =         {2009} } @Article{paper3,   author =       {Yuppie Networking},   title =        {My paper},   journal =      {The best journal},   year =         {2000} } 

Finally, to generate the document:

#!/bin/bash latex main.tex for auxfile in chap*.aux do     bibtex `basename $auxfile .aux` done latex main.tex latex main.tex 
like image 299
YuppieNetworking Avatar asked May 04 '10 12:05

YuppieNetworking


People also ask

How do you write a bibliography for a chapter in LaTeX?

To add the bibliography there, you can use \addcontentsline{toc}{chapter}{Bibliography} . As an alternative, you could use tools like biblatex which has options to add the it automatically to the toc.

Can you have two bibliographies in LaTeX?

Multibib is a LaTeX package that can be used to create multiple bibliographies in a paper. It is useful for creating several bibliographies, for example one containing Journal articles, one containing textbook references, yet another one containing references to patents; and so on.


1 Answers

some time ago i've quickly jotted down some notes on chapterbib. do they help you?

http://wiki.davidhaberthuer.ch/latex#chapterbib

like image 65
Habi Avatar answered Sep 19 '22 06:09

Habi