[Tex/LaTex] Multiple bibliographies

bibliographiesbibtexincludesubdividing

I have the following:

\documentclass{report}
\begin{document}
\include{chapter1}
\include{chapter2}
\end{document}

I also have a reference.bib file, with entries book1, book2 and book3.

chapter1.tex:

\chapter{Foo}
Some text and a reference to \cite{book1}. But also have a look in \cite{book2}...
\bibliographystyle{plain}
\bibliography{references}

and chapter2.tex being exactly the same except change book2 to book3. Thus book1 is cited in both, but book2 is only cited in chapter1 and book3 only in chapter2.

This produces "multiply-defined" warnings so I am looking for an easy way to do this properly. Any suggestions greatly appreciated.

EDIT:
Bibtex produces this:

This is BibTeX, Version 0.99c (TeX Live 2009/Debian)
The top-level auxiliary file: main.aux
A level-1 auxiliary file: chapter1.aux
The style file: plain.bst
A level-1 auxiliary file: chapter2.aux
Illegal, another \bibdata command---line 4 of file chapter2.aux
 : \bibdata
 :         {references}
I'm skipping whatever remains of this command
Database file #1: references.bib
Warning--empty publisher in book1
(There was 1 error message)

And the output from pdflatex is:

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(./main.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, ngerman, german, german-x-2009-06-19, ngerman-x-2009-06-19,    loaded.

(/usr/share/texmf-texlive/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo)) (./main.aux
(./chapter1.aux) (./chapter2.aux

LaTeX Warning: Label `book2' multiply defined.


LaTeX Warning: Label `book1' multiply defined.


LaTeX Warning: Label `book3' multiply defined.

)) (./chapter1.tex
Chapter 1.
(./main.bbl [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}])) [2]
(./chapter2.tex
Chapter 2.
(./main.bbl [3])) [4] (./main.aux (./chapter1.aux) (./chapter2.aux))

LaTeX Warning: There were multiply-defined labels.

)</usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmbx12.pfb>   </usr/sha
re/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share   /texmf-tex
live/fonts/type1/public/amsfonts/cm/cmti10.pfb>
Output written on main.pdf (4 pages, 38197 bytes).
Transcript written on main.log.

Best Answer

It seems that you are using the chapterbib package to produce your multiple bibliographies. The error messages that you are getting suggests that you are not compiling your document correctly.

I'll explain how to compile your document with a simple example; I'll assume that your main document is called test.tex and looks like this:

\documentclass{report}
\usepackage{chapterbib}
\begin{document}

\include{chapter1}
\include{chapter2}

\end{document}

The file chapter1.tex:

\chapter{Foo}
Some text and a reference to \cite{goossens93}. But also have a look in \cite{knuth79}...
\bibliographystyle{plain}
\bibliography{references}

The file chapter2.tex:

\chapter{Bar}
Some text and a reference to \cite{lamport94}. But also have a look in \cite{knuth79}...
\bibliographystyle{plain}
\bibliography{references}

The database references.bib:

@book{goossens93,
    author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
    title = "The Latex Companion A",
    year = "1993",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"

}

@book{knuth79,
    author = "Donald E. Knuth",
        title = "Tex and Metafont, New Directions in Typesetting",
    year = {1979{(}1950{)}},
    publisher = "American Mathematical Society and Digital Press",
    address = "Stanford"
}

@book{lamport94,
    author = "Leslie Lamport",
    title = "Latex: A Document Preparation System",
    year = "1994",
    edition = "Second",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"
}

You have to compile your document in the following way:

pdflatex test
bibtex chapter1
bibtex chapter2
pdflatex test
pdflatex test

In your actual document, as a first step, you'll need to remove the auxiliary files to prevent possible inherited errors.