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.
  • 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? May 5, 2011 at 13:30
  • @GonzaloMedina I added more detail. Is that enough?
    – Unapiedra
    May 5, 2011 at 13:42
  • Also, the file chapter2.tex should not have \bibliographystyle{} in it!
    – Unapiedra
    May 5, 2011 at 13:55
  • It seems that you forgot to mention that you are using the chapterbib package. May 5, 2011 at 14:19
  • I wasn't using the chapterbib package.
    – Unapiedra
    May 5, 2011 at 18:15

3 Answers 3


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.

  • Okay, it works now.
    – Unapiedra
    May 5, 2011 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, 2011 at 19:35
  • @Gonzao, Since I have nested tex files, I can't use \include, using input on my case doesn't generate any errors, but in the final test.pdf file, there are no references. See my complete question please: tex.stackexchange.com/questions/375642/…
    – Amir
    Jun 19, 2017 at 17:12
  • TexStudio does not run bibtex on included files, so I needed this fix: tex.stackexchange.com/questions/297430/… Nov 27, 2017 at 3:58
  • @Gonzalo Medina In my situation, I could only have the bibliography at the end of each chapter, but there is no reference number in the places where I make the citation, do you know the reason for that? thanks!
    – Ogawa Chen
    May 22, 2019 at 6:13

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 "================================================================"

You CAN run bibtex on your root *.tex file without a problem.

However, in that case you might encounter the Illegal, another \bibdata command error if you use the \bibliography command more than once with different files.

In this case, instead of:




That'll fix it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .