Setting TEXINPUTS for pdflatex in Ubuntu
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 videos on Youtube
thornate
Updated on November 19, 2020Comments
-
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 almost 11 yearsAre you using
pdftex
orpdflatex
. The latter will read\input{header.tex}
as a braced argument for fileheader.tex
, butpdftex
is Knuth's plain format with the pdfTeX engine: there,\input
has primitive syntax only, and the file name searched is{input.tex}
. -
thornate almost 11 yearsAha! pdflatex works, but pdftex doesn't. Thanks for explaining.
-
Joseph Wright almost 11 yearsI'll write that up in a slightly modified form as an answer, then :-)
-
Martin Schröder almost 11 yearsStart your documents with
\NeedsTeXFormat{LaTeX2e}
to get a meaningful error message if you use the wrong program.
-
-
egreg almost 11 yearsIt may be worth noting that
\input{filename}
works also in LuaTeX (as opposed to LuaLaTeX). -
Joseph Wright almost 11 years@egreg One of the 'features' of LuaTeX which gives me headaches :-)