Definition of the TEXINPUTS variable

You can always put your personal files in a proper subdirectory of ~/texmf; for instance, your personal .sty files could go in

~/texmf/tex/latex/jana/

This "personal tree" is always consulted for input files before the other trees and doesn't need hashing (with texhash aka mktexlsr). This is by far the preferred method for personal input files.

If instead you have a folder somewhere, you can set the variable TEXINPUTS in the environment by saying something like

export TEXINPUTS=/path/to/the/local/folder//:

The // means that TeX programs will search recursively in that folder; the trailing colon means "append the standard value of TEXINPUTS" (which you don't need to provide).

Note that TEXINPUTS is usually not set; it takes a value as soon as a TeX program is started (by reading a set of texmf.cnf files). However, if the program finds it in the environment, it follows the rule sketched above.

If you need the current directory to be searched for inputs before the local one, then

export TEXINPUTS=.:/path/to/the/local/folder//:

should be the best choice.


The question asks for a definition of the environmental variable TEXINPUTS: it controls where LaTeX searches for input files, the default is:

  1. First your current directory.
  2. Second the local ifp styles held in /ifp/latex/ and its subdirectories.
  3. Third the standard system LaTeX directories, where are held in /usr/share/texmf/tex/latex/ and its subdirectories.

TEXINPUTS can contain a list of paths. I am using "xelatex" on windows, and in that environment you must separate the separate path entries by semicolon. Colon will not work. If you want LaTeX to find files in the current folder be sure to include a "." in as one of the entries. Some sources sensibly recommend adding your personal path into the existing setting without looking the rest of the path by using a construct like this:

TEXINPUT=.;/Home/loginname/mystyles/;$TEXINPUTS

The other answer seems to be on the subject of how to use it (and there are plenty of comments saying simply don't use it.) However, in my case, I have a collection of content stored in a source management system organized according to the team that maintains the content, but we need to compose a book out of various selections of the content pieces. Putting that content into a particular folder on the current machine is out of the question. We have to have a way for each book specify where to find all the content. We have not found any other way to specify in the build script where LaTeX is supposed to find all the pieces of the book.