Skip to: Site menu | Main content

Many LaTeX documents, one BibTeX database

Biblioteca Vasconcelos

As a researcher, I spend most of my time writing LaTeX, using many tools, among which BibTeX, the bibliography database processor. Our team manages a huge .bib file centralizing all publications we read and might need to cite someday.

Since nearly everything we write uses that file, it gets linked or copied into each the source directory of each new document. Some of us even have a bash alias to automate that copy, but they still have to invoke it for each new paper. But…

Zero cost solution:
Just put the database somewhere in BibTeX’s search path!

Duh… Seems obvious, but somehow it took me 10 years of regular LaTeX usage to think of it… Anyway, to see where BibTeX will look, run this1:

kpsepath bib

This should display a $PATH-like colon-separated list of directory names2. With a standard TeXlive installation, there should be:

By default, the per-user directory is ~/Library/texmf on Mac and ~/texmf on Linux; this is where you would install third-party packages, by the way.

In our case, the ///bibtex/bib// suffix means that BibTeX will look for files anywhere under a bibtex/bib directory, itself at any depth under texmf. So we just need to create ~/Library/texmf/bibtex/bib, symlink our foo.bib files in there.

We can check that all is good:

$ kpsewhich lse.bib

It finds the newly installed foo.bib, so voilà, \bibliography{foo} now works in any document without further preparation!

  1. The kpse* commands are from Kpathsea, the library to quickly locate files in the TeXlive hierarchy.

  2. Compared to the usual unix search paths, there are a couple extensions: // means to search subdirectories recursively, and a leading !! means to look only in the cached index, never on the disk.

Some rights reserved. Except where otherwise noted, this website by is licensed under Creative Commons Attribution-Share Alike 2.0 France.
Generated by nanoc, ruby, sass, haml, markdown, kramdown, slides, jquery, easing, hyphenator.js
Last updated on 2014-11-23.  Toggle hy-phe-na-ti-on.
Creative Commons License Back to top