Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

publications/
    bibliography/biblio.bib
    templates/
        ....
    conferences/
        <name of conference>/<name of article>/<article files (tex etc.)>
    journals/
        <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

3 Answers 3

up vote 3 down vote accepted

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

publications/
    bibliography/biblio.bib
    ....
    paper1/
        paper1.tex
        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

 
discard

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.