208

I would like to use multiple .bib files for my article, such as file1.bib, file2.bib.

However, I would like my references not to be separated (such as "Primary sources", "Secondary sources", etc.). These bibliographies just need to be merged into one.

One way to do this is to copy-paste these .bib files into one .bib file, and this would solve the problem. However, I would like to keep it split into several .bib files, by topic (file1.bib contains articles on topic1, file2.bib contains articles on topic2, and so on).

I tried to do

\bibliographystyle{alpha}

\bibliography{file1} \bibliography{file2}

but this just gives me the same bibliography twice!

Olivier
  • 208
Andrey
  • 2,081

2 Answers2

299

The correct way to load multiple bib files is to use

\bibliography{file1,file2}

Note the lack of space between the comma and the files!

yeti
  • 3
  • 2
Guido
  • 30,740
  • 21
    What if there is a conflict in bibtexkeys of the two files? – Orion Jun 26 '13 at 18:52
  • 29
    Only one of them will be include (the first one) and bibtex will report a Repeated Entry message and will skip the second one. – Guido Jun 26 '13 at 20:59
  • 10
    @Guido, may I ask why the space between the comma and the second filename is important? – Leo Fang May 06 '14 at 04:15
  • 11
    @LeoFang otherwise bibtex will report a white space in arguments and will ignore the bibtex files after the space. – Guido May 06 '14 at 11:39
  • 8
    The lacking space does the trick, thank you – hoeni Dec 14 '14 at 15:33
  • How do I use a bib file and additional bib items (\bibitem{}) in a tex file at the same time? – Rob Jun 18 '15 at 15:17
  • 1
    @Rob this is a totally different question (not for a comment). – Guido Jun 18 '15 at 20:56
  • This is not working for me, I want to load two bib-files, the second got ignored. I am using bibtex and natbib. Any ideas why? – Pille Mar 31 '17 at 14:21
  • What if I want each element on a new line, in the TEX source code? I've tried to add % and \\\ at the end of each line, but it does not work. Any other trick I could try? I have as many BIB files as chapters in my documents... – Atcold Jun 22 '17 at 20:25
  • @Atcold you can use % at the end of each line, but do not leave any space between the comma and %. file1,%. – Guido Jun 22 '17 at 22:37
  • What if the files are in a relative path, say "../Bib Files/" and all the files are in this folder? – Zack Fair Sep 25 '20 at 18:49
  • 1
    @ZackFair if the folder where the bib files is not in the BIBINPUTS variable, then the path for each file should be specified – Guido Sep 28 '20 at 23:00
  • Thanks. That worked. just had to replace every file with .../Bib Files/filename – Zack Fair Sep 29 '20 at 05:26
  • I should have read your note about the lack of space. I spent 2 hours trying to debug it. – Vik Mar 13 '21 at 01:45
49

If you use the biblatex package and need to load multiple bib files, each bib file needs to be loaded separately via an \addbibresource instruction:

\addbibresource{file1.bib}
\addbibresource{file2.bib}

For more information, see section 3.6.1, "Resources", of the reference manual of the biblatex package.


Addendum, March 2024: The section on "Resources", which was numbered 3.6.1 when I posted this answer back in Feb. 2016, is numbered 3.8.1 in the current version of the biblatex reference manual.

Mico
  • 506,678