Skip to content

Finding Files ​

In order to find files included in a document via \input or \include, RefTeX searches all directories specified in the environment variable TEXINPUTS. Similarly, it will search the path specified in the variables BIBINPUTS and TEXBIB for BibTeX database files.

When searching, RefTeX will also expand recursive path definitions (directories ending in ‘//’ or ‘!!’). But it will only search and expand directories explicitly given in these variables. This may cause problems under the following circumstances:

  • Most TeX system have a default search path for both TeX files and BibTeX files which is defined in some setup file. Usually this default path is for system files which RefTeX does not need to see. But if your document needs TeX files or BibTeX database files in a directory only given in the default search path, RefTeX will fail to find them.
  • Some TeX systems do not use environment variables at all in order to specify the search path. Both default and user search path are then defined in setup files.

There are three ways to solve this problem:

Some people like to use RefTeX with noweb files, which usually have the extension .nw. In order to deal with such files, the new extension must be added to the list of valid extensions in the variable reftex-file-extensions. When working with AUCTeX as major mode, the new extension must also be known to AUCTeX via the variable TeX-file-extension. For example:

emacs-lisp
(setq reftex-file-extensions
      '(("nw" "tex" ".tex" ".ltx") ("bib" ".bib")))
(setq TeX-file-extensions
      '("nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))