There are several *.bib files in one directory which I want to add to my bibliography.

I don't want to add them one by one like this:


I tried adding the directory to bibtex like this: (see here)

bibtex --include-directory "../dir/

resulting in

bibtex: unrecognized option '--include-directory=../dir/'

This option seems to be specific to mikTeX BibTeX, but I am using TeXLive.

Is there a way to add all *.bib files in ../dir/ to my bibliography?

I am already using TeX, BibTeX and Make, so a solution using those tools is preferred, although any solution is welcome.

  • 2
    If you want to go ballistic, a scripting language might help you there. :) Say, in Ruby: p = lambda {|q| puts '\\bibliography{'.concat(Dir::glob(q.concat('*.bib')).map!{|x| x[0..-5]}.join(",")).concat('}')}; p.call('../Sandbox/') gives me \bibliography{../Sandbox/mybiblio,../Sandbox/test196,../Sandbox/mybiblio2}. :) – Paulo Cereda Jul 23 '14 at 19:05
  • You may want to use biblatex-biber: tex.stackexchange.com/questions/459222 – Bart Michels Jan 20 '19 at 20:13

By default, in TeX Live bibtex looks for local .bib files in your local texmf/bibtex/bib folder. So you can put your directory containing the bib files there, or make a symbolic link inside that folder to your directory. Either one will work. Then you just use \bibliography{a,b,c} for .bib file a.bib, b.bib etc.

  • I'd like to add that I had to run tlmgr update --self --all to make bibtex find the new files in texmf-local/bibtex/bib. Maybe there is another way, but this worked for me. – marktani Jul 24 '14 at 11:26
  • 1
    @mcwise This probably means you didn't put the files into your local (i.e. user level) texmf but into the system-wide local texmf folder. The system-wide folder is in /usr/local/texlive/texmf-local; your user level folder is in different places depending on your OS. (To find out what it is you can use the command line kpsewhich -var-value TEXMFHOME). Files in the texmf-local folder (but not in TEXMFHOME) require the mktexlsr command to be to rebuild their file databases; this is what tlmgr did when you updated. The update itself wasn't actually relevant. – Alan Munn Jul 24 '14 at 22:08
  • Right, I was able to follow your steps and actually put the symbolic link in my user level folder :) – marktani Jul 25 '14 at 10:07

As far as I know, there is no built in way to add all files in one directory, something like \bibliography{*.bib}.

However, you could set the environment variable BIBINPUTS to ./dir:; then you will be able to use \bibliography{a,b,c} to load ./dir/a.bib, ./dir/b.bib and so on. You could also set as many paths as you want, something like ./dirA:./dirB:./dirC:. The colon here is used to separate paths and when used on the beginning or in the end, is used to add the default path.

To set BIBINPUTS you could use env BIBINPUTS='./dir:' pdftex yourfile.tex in your command line or Makefile.

There is also a BSTINPUTS variable to set paths for .bst files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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