TeX Live and MacTeXwhere do i put my personal shared bib file in texlive?

Information and discussion about TeX Live distribution for all platforms (Windows, Linux, Mac OS X) and the related MacTeX: installing, updating, configuring
Post Reply
dl3fo3
Posts: 10
Joined: Mon Jan 05, 2009 4:35 pm

where do i put my personal shared bib file in texlive?

Post by dl3fo3 »

I have a tex file called my-include.tex that need to be shared by a lot of my papers.
my-include.tex contains things like:

Code: Select all

\newcommand{\abs}[1]{\left\vert #1 \right\vert}
\newcommand{\set}[1]{\left\{ #1 \right\}}
I put my-include.tex on the directory ~/texmf/tex/latex/ so that i can add

Code: Select all

\include{my-include}
in the preamble of my latex documents.

I also have a bib file that need to be shared by a lot of my papers.
I want to do the same thing with my shared bib file called my-reference.bib.
I put my-reference.bib at ~/texmf/tex/latex/ and wrote a test document abc.tex that contains \bibliography{my-reference} and ran:

Code: Select all

texhash
latex abc.tex
latex abc.tex
bibtex abc
latex abc.tex
And this doesn't work.
If I change \bibliography{my-reference} to use absolute path (\bibliography{/home/fj/texmf/tex/latex/my-reference}), then it works.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

where do i put my personal shared bib file in texlive?

Post by kaiserkarl13 »

There is an environment variable that pdflatex uses (in UNIX-based installations, at least) called "BSTINPUTS" that tells BibTeX where to look for BST files. There's another called "BIBINPUTS" that tells it where to look for .bib files and a third called "TEXINPUTS" where it looks for things to include from the \input, \include, \includegraphics, and other commands.

In your case, you would type

Code: Select all

export BIBINPUTS=".:$HOME/texmf/tex/latex:"
export BSTINPUTS=".:$HOME/texmf/tex/latex:"
export TEXINPUTS=".:$HOME/texmf/tex/latex:"
The . at the beginning tells *TeX to search in the current directory BEFORE your includes directory.

Add the above lines to your ~/.bashrc file (if you use bash) or ~/.zshrc file (if you use Z-shell); if you use csh or tcsh, add them to ~/.cshrc and replace export with setenv and the = with a space.

Then put all of your files that you wish to include in ~/texmf/tex/latex and you should be able to include them from anywhere. If they aren't all in the same place, include both directories (separated by colons).

Important: The colon at the end of these statements is very important. If omitted, it will ONLY look in the two directories provided instead of everywhere the system normally looks for such files!
dl3fo3
Posts: 10
Joined: Mon Jan 05, 2009 4:35 pm

where do i put my personal shared bib file in texlive?

Post by dl3fo3 »

I've learned that the structure of ~/texmf should be like other texmf trees.

Code: Select all

$ locate '.bib'
...
/usr/share/texmf-texlive/bibtex/bib/minitoc/fminitoc.bib
/usr/share/texmf-texlive/bibtex/bib/minitoc/minitoc.bib
/usr/share/texmf-texlive/bibtex/bib/minitoc/mtc-add.bib
/usr/share/texmf-texlive/bibtex/bib/msc/biblio.bib
Locating bib files, one sees that bib files should be placed in bibtex/bib. So personal shared bib file my-reference.bib should be placed in ~/texmf/bibtex/bib/
Post Reply