TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Being a PhD student, I have written/will write several papers. Most of them share a common bibliography file and some styles, so I created a directory tree like this:

        <name of conference>/<name of article>/<article files (tex etc.)>
        <name of journal>/<name of article>/<article files (tex etc.)>

The problem is that each paper contains references to the parent directories, so it must be compiled inside this environment.

I am now thinking of creating independent directories, i.e., moving bibliography and templates inside each directory.

How did you solve this problem? Which layout do you use?

EDIT: I'd also like to move them to other computers, using a version control system and two computers that can work using the VCS.

share|improve this question
To clarify: your question is "I currently use relative paths to load my bibliography etc, but I want to change my directory set up; how should I do this?" Could you explain why the current directory structure is no longer satisfactory? – Seamus Mar 25 '11 at 13:24
Because all the files are tied together and I can not move a single directory (paper) to another location or machine. – Andrea Spadaccini Mar 26 '11 at 1:47
up vote 4 down vote accepted

If your filesystem supports it, you can use symbolic links, having a structure like that:

        biblio.bib -> ../bibliography/biblio.bib

The main advantage of this structure is, that you can just put the folder paper1 into an archive and have all data necessary for building the paper in there. I use tar for that task with the h option, which dereferences the symlink and puts the actual file into the archive:

tar cvzfh paper1.tar.gz paper1/

EDIT: Using a VCS is possible with that structure, if your VCS supports symlinks, i.e. it does NOT follow the symlink and store the actual file, but the symlink itself (SVN does this for example). You have to put the common files such as the bibliography into the VCS as well. For using it from another machine, you would have to checkout your common files and the paperX you want to work on. The symlinks from the paperX directory should be preserved.

I haven't tested it myself, but it should work at least if you only use systems with symlink support and of course a symlink-aware VCS.

EDIT2: One issue I've forgot, you have to create a relative symlink such as biblio.bib -> ../bibliography/biblio.bib. If you create an absolute one such as /home/user/publications/bibliography/biblio.bib you need the same absolute path on every machine. So to have it more portable, use relative symlinks.

share|improve this answer
+1 very nice, didn't know about the h option of tar. – Andrea Spadaccini Mar 26 '11 at 15:11

Put them in your local TDS tree.

Suppose you are using TeX Live, you can put foo.bib in /texmf-local/bibtex/bib/*, and put foo.sty, foo.cls, foo.tex in /texmf-local/tex/latex/*.

After that, run texhash.

share|improve this answer
+1 this is a nice solution but I don't think that I can easily move those files around machines. Please see the new edit note. – Andrea Spadaccini Mar 26 '11 at 15:11
then you can use something like \bibliography{../bib/foo}. – Leo Liu Mar 26 '11 at 15:58
You can also use your home TEXMF tree, e.g., ~/texmf/bibtex/bib. What I did in a comparable situation was placing a symlink in the home TEXMF tree that points to the bibliography database inside the version-controlled directory. – Philipp Mar 26 '11 at 18:32

What I did was a combination of Leo's and Bruno's answers: I placed the database itself in a version-controlled directory, and placed a symbolic link to it in the non-version-controlled home TEXMF tree:

cd "$(kpsewhich --var-value=TEXMFHOME)"
mkdir -p bibtex/bib
cd bibtex/bib
ln -s ~/publications/bibliography/biblio.bib
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.