# Creating a central bibliography

I am trying to create a central bibliography (.bib file) in a directory outside of my LaTeX project. I want to do this so I don't have to have different .bib's for each paper I write. Currently in each .tex file I write:

\bibliography{central-bibliography}


at the end where I want to put it. My .bib file is called central-bibliography.bib. The .bib file is in the same directory as the .tex file.

If I put the .bib file in an arbitrarily located directory, how would I reference it in the .tex file?

-

You can reference central-bibliography.bib at an absolute or relative (preferred) location from within the \bibliography command:

\bibliography{../references/central-bibliography}


Note the use of / and not \. Although it is not always required, using / (forward slash) works across most (all?) operating systems.

If you want to modify this from a location at the start of your document, you could also define a command to store the relative location:

\documentclass{<class>}
\newcommand{\myreferences}{../references/central-bibliography}
%...
\begin{document}
%...
\bibliography{\myreferences}
%...
\end{document}

-

The easiest way to do this is to place your .bib file where TeX can find it, which is conveniently done using your local TeX tree. Some of the basics for finding the right location are discussed in Where do I place my own .sty files, to make them available to all my .tex files?, which focusses on .sty files. On my TeX Live installations, I use the locations:

• Windows C:\Users\<user name>\texmf\bibtex\bib\local
• Mac OS X ~/Library/texmf/bibtex/bib/local
• Linux ~/texmf/bibtex/bib/local

With a recent TeX Live, you can simply place your .bib file in the appropriate place and it will be found, so you can use

\bibliography{myfile}


with no path at all. With an older TeX Live you may need to run texhash first. MiKTeX also allows the same local installation procedure.

The only minor issue with placing a .bib file in your local texmf tree is that it's not so convenient for editing as if it were in the Documents folder. I get around this by using a link, so I actually have my .bib file on my Mac in ~/Documents/Literature and link from there to ~/Library/texmf/bibtex/bib/local using the Unix ln command. On Windows 7 you can do a similar thing using the mklink (you need to have Admin rights to do this).

An alternative approach is to use the BIBINPUTS environmental variable to set a path to be searched for .bib files, again allowing you use the file name directly with no path. Setting environmental variables depends on the operating system you are using.

-
TeX Live is slightly pickier about placement of these files. ".bib" files go in ~/Library/texmf/bibtex/bib or subfolders of this directory, and ".bst" files go in ~/Library/texmf/bibtex/bst or subfolders of this directory. –  Ans Mar 16 at 12:52