Setting TEXINPUTS for pdflatex in Ubuntu

1,384

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.

Share:
1,384

Related videos on Youtube

thornate
Author by

thornate

Updated on November 19, 2020

Comments

  • thornate
    thornate almost 3 years

    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?

    • Joseph Wright
      Joseph Wright almost 11 years
      Are you using pdftex or pdflatex. The latter will read \input{header.tex} as a braced argument for file header.tex, but pdftex is Knuth's plain format with the pdfTeX engine: there, \input has primitive syntax only, and the file name searched is {input.tex}.
    • thornate
      thornate almost 11 years
      Aha! pdflatex works, but pdftex doesn't. Thanks for explaining.
    • Joseph Wright
      Joseph Wright almost 11 years
      I'll write that up in a slightly modified form as an answer, then :-)
    • Martin Schröder
      Martin Schröder almost 11 years
      Start your documents with \NeedsTeXFormat{LaTeX2e} to get a meaningful error message if you use the wrong program.
  • egreg
    egreg almost 11 years
    It may be worth noting that \input{filename} works also in LuaTeX (as opposed to LuaLaTeX).
  • Joseph Wright
    Joseph Wright almost 11 years
    @egreg One of the 'features' of LuaTeX which gives me headaches :-)