# Per-project texmf directory

Is it possible to specify a texmf directory from within a tex file? I think a project-specific way to set the TEXMFHOME environment variable, instead of within the ~/.bashrc file would work.

Motivation
I mostly use the Kile LaTeX editor on KDE, but I synchronise my TeX project tree over to other computers using git; on OSX I have MacTex installed.

I've just installed the Myriad Pro OTF font package using Michael Gährken's package, and would like this font to be used on all machines without having to edit local files and folders on each host.

-

You can't change the kpathsea (pseudo)environment variables once the pdftex process has been started. But you can change their value before launching the process:
TEXMFHOME="/path/to/new/texmfhome:\$(kpsewhich -var-value TEXMFHOME)" pdflatex filename

This will prepend the "new home" to the current value; the syntax used assumes bash.
Thanks for the explanation (+1)! I figure the LaTeX builder (e.g. Kile/MacTex) should allow configuration of the build environment. Kile, at least though, doesn't seem to have settings to configure the build commands' environment; only the commands' arguments. So to make this work (on KDE), I'd have to set TEXMFHOME in /etc/environment (or whichever file it is that configures the global KDE environment). Would you consider this a bug/limitation of Kile? Can I define TEXMFHOME in a project-specific config file or something? –  Alex Leach Nov 5 '12 at 12:26
Good point. The template I'm using came with a Makefile, which I haven't been using, but I can configure Kile (and MacTex I imagine) to just run make. Obviously I've got to add your changes to the Makefile, but that will do :) –  Alex Leach Nov 5 '12 at 13:40