[Tex/LaTex] where to put .sty and .cls file for project


I want to use my own .sty and .cls file in a project. I know of the following two possibilities of placing them:

  • in my local tex tree (or the general tex tree, which is worse)

  • in the same directory as the .tex file

Both of these I find unsatisfactory for the following reasons:

The local tex tree is unsatisfactory since the .sty file is specific for the project, so I want it to be close to the project, so I easily remember where it is etc. Also, I am using dropbox to synchronize the project files between different computers automatically, so the .sty file should be in the dropbox folder.

The 'same directory' is unsatisfactory since the project is in a directory with many subdirectories. The .tex files in all these subdirectories should be able to access the same .sty file.

What I would like to do is: create a subdirectory 'style files' in the project directory, where I put style and class files (there are several for the project), then tell tex somehow where to find them.

How can I do this?

I am using a recent TexLive on Mac OS X.6

I know there have been questions about placement of .sty files, but I did not find an answer to this question.

Best Answer

there is a third possibility and for projects the best one: put all in a texmf directory which is located inside your documents directory. Then do a export TEXMFHOME=texmf before running pdflatex or something else and the texmf tree will be searched first.

Inside this local texmf you must have the same TeX Directory Structure as usual: http://tug.org/tds For a local texmf tree you do not need to run texhash because files are searched recursively in that tree

Related Question