A good way is to use Rainer Schöpf's verbatim package,
which provides a command
\verbatiminput that takes a file name as
Another way is to use the
alltt environment, which
requires the alltt package. The environment interprets its
contents “mostly” verbatim, but executes any (La)TeX commands it
of course, this is little use for inputting (La)TeX source code…
The moreverb package extends the verbatim package,
listing environment and a
command, which line-number the text of the file. The package also has
\verbatimtabinput command, that honours TAB characters in
the input (the package's
listing environment and the
\listinginput command also both honour TAB).
The fancyvrb package offers configurable implementations of everything verbatim, sverb and moreverb have, and more besides. It is nowadays the package of choice for the discerning typesetter of verbatim text, but its wealth of facilities makes it a complex beast and study of the documentation is strongly advised.