TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following:


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


Some text and a reference to \cite{book1}. But also have a look in \cite{book2}...

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
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.

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]
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
Output written on main.pdf (4 pages, 38197 bytes).
Transcript written on main.log.
share|improve this question
There's no apparent reason for the warnings to be caused by the \cite commands. Can you please add the exact warning message that you are getting? – Gonzalo Medina May 5 '11 at 13:30
@GonzaloMedina I added more detail. Is that enough? – Unapiedra May 5 '11 at 13:42
Also, the file chapter2.tex should not have \bibliographystyle{} in it! – Unapiedra May 5 '11 at 13:55
It seems that you forgot to mention that you are using the chapterbib package. – Gonzalo Medina May 5 '11 at 14:19
I wasn't using the chapterbib package. – Unapiedra May 5 '11 at 18:15
up vote 16 down vote accepted

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:




The file chapter1.tex:

Some text and a reference to \cite{goossens93}. But also have a look in \cite{knuth79}...

The file chapter2.tex:

Some text and a reference to \cite{lamport94}. But also have a look in \cite{knuth79}...

The database references.bib:

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


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

    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.

share|improve this answer
Okay, it works now. – Unapiedra May 5 '11 at 19:26
It works now. I found out that I actually want \sections. I used the rootbib option, as documented which then worked. – Unapiedra May 5 '11 at 19:35
Thank you, so much. It helped me – Manpreet Dhiman Apr 28 at 11:27

I created a small csh script to do that easily in shell.

First make sure to have csh installed first - sudo apt-get install csh.

Then save your files following the pattern root_chapX.tex where root is the name of your main file (e.g., test) and chapX is anything you want (the important thing is to have an underscore between the two).


set base = "root"

echo " Compiling root tex file"
pdflatex $base
echo "================================================================"

echo " Running bibex on included files"
set pattern = ${base}_*.tex
foreach auxfile ($pattern)
  bibtex `basename $auxfile .tex`
echo "================================================================"

echo " Compiling root tex file"
pdflatex $base
pdflatex $base
echo "================================================================"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.