Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

\bibliography{../dir/a,../dir/b,../dir/c}

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.

share|improve this question
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 at 19:05

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
Thanks, that's a nice solution! –  mcwise Jul 23 at 21:53
    
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. –  mcwise Jul 24 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 at 22:08
    
Right, I was able to follow your steps and actually put the symbolic link in my user level folder :) –  mcwise Jul 25 at 10:07

Your Answer

 
discard

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.