Creating a central bibliography
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 or .cls 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.
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}
Simply, put your bibfile in any place in your laptop. For example in the Drive "D" in the folder Ph.D.
Now, suppose your bibfile`s name is centralbibfile.bib All what you need to do is to tell the program where is your bibfile and what is its name as follows:
\bibliography{D:/Ph.D/centralbibfile}