Previous: , Up: Splitting the input   [Contents][Index]


24.3 \input

Synopsis:

\input{filename}

LaTeX processes the file as if its contents were inserted in the current file. For a more sophisticated inclusion mechanism see \include & \includeonly.

If filename does not end in ‘.tex’ then LaTeX first tries the filename with that extension; this is the usual case. If filename ends with ‘.tex’ then LaTeX looks for the filename as it is.

For example, this

\input{macros}

will cause LaTeX to first look for macros.tex. If it finds that file then it processes its contents as thought they had been copy-pasted in. If there is no file of the name macros.tex then LaTeX tries the name macros, without an extension. (This may vary by distribution.)

To make your document portable across distributions and platforms you should avoid spaces in the file names. The tradition is to instead use dashes or underscores. Nevertheless, for the name ‘amo amas amat’, this works under TeX Live on GNU/Linux:

\input{"amo\space amas\space amat"}

and this works under MiKTeX on Windows:

\input{{"amo amas amat"}}

Unofficial LaTeX2e reference manual