[Tex/LaTex] Setting TEXINPUTS for pdflatex in Ubuntu

environment-variablespdftextexinputsUbuntu

I have a set of files that are commonly used as inputs in my tex files, so I put them in a directory and set the path in the TEXINPUTS environment variable (in Ubuntu). This works fine when compiling files with the latex command, but if I compile them with pdftex, it gives the following error message:

! I can't find file `{header.tex}'.
l.1 \input{header.tex}

As far as I can tell, pdftex is completely ignoring the TEXINPUTS environment variable. Does it use a different environment variable? How can I get it to recognise a path?

Best Answer

The latex command runs LaTeX in DVI-output mode. LaTeX's definition of \input allows for a syntax

\input{<file-name>}

where the <file-name> is read as a braced argument. The pdflatex command will do exactly the same but with direct PDF output.

On the other hand, pdftex runs plain TeX with direct PDF output. The plain TeX definition for \input uses a 'primitive' syntax, in which the name is read as any tokens at all up to the first space. Thus with pdftex

\input{<file-name>}

ends up looking for a file called {<file-name>}, including the braces.

Related Question