Computer Scientist, Graduate Student, and Geek

Tag: bibtex

LaTeX and BibTeX Search Path

October 22, 2009

I often write papers in LaTeX that use the ACM SIG Proceedings Template. Previously, I would put a copy of the LaTeX style file (.sty) in every directory where I had a LaTeX document that used it. Then I discovered I could set an environment variable to automatically have LaTeX search a path for a style file.

The TEXINPUTS environment variable works similar to the PATH environment variable: it is a list of paths where LaTeX should search for necessary class and style dependencies. I created a folder in my home directory where I keep the ACM SIG Proceedings Template LaTeX style file. I set the TEXINPUTS variable in my .bashrc.

There is also a BIBINPUTS environment variable to search for BibTeX files. I have started putting all the references I use in a single file, to avoid having small BibTeX files all over the place. I put my central BibTeX file in the same location as the LaTeX style file and set the BIBINPUTS variable in my .bashrc.

The following few lines in my .bashrc set the two environment variables:

# Include shared LaTeX classes and BibTeX files in path, if LaTeX folder exists
if [ -d "~/latex" ]; then
    export TEXINPUTS=".:~/latex/:"
    export BIBINPUTS=".:~/latex/:"
fi

Categories: Linux

Tags: bash, bibtex, latex