31

I am using TeX Live 2012/Debian on Linux Mint 14.

I am wondering what the right definition of the TEXINPUTS variable is.

  • 2
    Don't define TEXINPUTS in the environment if you don't have compelling reasons to do it, such as the need to set some shared input directory. – egreg Jan 14 '13 at 11:11
  • 2
    I have a local folder where I put extra stuff in. Therefore I need to define the variable and somehow adding :$TEXINPUTS in the definition does not work. – Jana Jan 14 '13 at 12:03
  • 2
    you should not set TEXINPUTS. You'll get problems when using ConTeXt or LuaTeX beside pdflatex – user2478 Jan 14 '13 at 12:30
  • 2
    @Herbert, what problems? How should we refer to collections of other latex content instead? We have used TEXINPUTS to manage large collections of files created by different people for many years. What should we do to use lualatex? – Leo Mar 6 '14 at 19:43
47

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.

  • I have the following: export TEXINPUTS=.:/path/to/my/local/folder//:/usr/share/texmf//:/usr/share/texlive/texmf//. But now it is missing a lot of files. For example inputenc.sty. – Jana Jan 14 '13 at 12:38
  • @Jana That's surely a wrong way to do that. – egreg Jan 14 '13 at 13:08
  • 1
    Problem is that I do not know the right way. – Jana Jan 14 '13 at 13:17
  • 3
    @Jana Did you try my answer? As I've added, for clarity, you don't need to add the value of TEXINPUTS, the trailing colon suffices. – egreg Jan 14 '13 at 13:32
  • 1
    @Leo In my experiment it works with lualatex – egreg Mar 6 '14 at 20:50
2

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.

  • That is so strange! Why did the xelatex developers use non-standard semicolons instead of colons? – vy32 Oct 7 '18 at 17:12
  • @vy32 the semicolons are there for all Windows environments not just XeLaTeX on unix or mac they are colons its a Windows thing just for this windows specific alternative answer – KJO Apr 1 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.