[Tex/LaTex] Configuring TEXINPUTS from AUCTeX

auctextexinputs

I'm working on a collaborative (version controlled) LaTeX project. We have a bunch of custom .sty files in a subdirectory of our project named tex. We set TEXINPUTS=".:tex:" in the project Makefile so that we can use \usepackage{foo} instead of \usepackage{tex/foo}. This avoids annoying LaTeX warnings and avoids the need to modify those .sty files that \input or \RequirePackage another file in the same tex directory. All of this works well.

What doesn't work well is AUCTeX. We add the following to the bottom of each of our LaTeX sources:

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../relative/path/to/main.tex"
%%% End:

Unfortunately, hitting C-c C-c LaTeX results in an error because TEXINPUTS isn't set properly.

Here are my questions:

  • Is there a TeX macro that allows us to change the TeX input search path from within the document itself?
  • Is there a non-risky file local variable we can use to tell AUCTeX to set TEXINPUTS when it runs LaTeX?
  • Is there an alternative approach we can take? I don't want each user to have to modify his/her environment before starting emacs.

Best Answer

%%% Local Variables:
...
%%% eval: (setenv "TEXINPUTS" "--place your setting here---")
...

Look in to this thread for some more information http://lists.gnu.org/archive/html/auctex/2005-05/msg00097.html