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.

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

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.
share|improve this question
Have you tried setting TEXINPUTS from a shell (export TEXINPUTS=.:tex:${TEXINPUTS} in bash syntax) and invoking AUCTeX from there? – Daniel Dec 5 '11 at 20:53
@Daniel: Yes, and that works, but I don't want each user to have to modify his/her environment before starting emacs. – Richard Hansen Dec 5 '11 at 21:44
%%% 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

share|improve this answer
I'm looking for a safe file local variable I can set -- adding eval: (setenv "TEXINPUTS" ...) results in a warning when the file is visited. – Richard Hansen Feb 3 '12 at 5:15

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.