Including a file verbatim in LaTeX

A good way is to use Rainer Schöpf's verbatim, which provides a command \verbatiminput that takes a file name as argument.

Another way is to use the alltt environment, which requires alltt. alltt interprets its contents 'mostly' verbatim, but executes any TeX commands it finds: so one can say:

  \begin{alltt}
  \input{verb.txt}
  \end{alltt}
of course, this is little use for inputting (La)TeX source code...

Moreverb extends the facilities of verbatim package, providing a listing environment and a \listinginput command, which line-number the text of the file. The package also has a \verbatimtabinput command, that honours TAB characters in the input (the listing environment and command also both honour TAB).

The fancyvrb package offers configurable implementations of everything verbatim 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.

alltt.sty
Part of the LaTeX distribution.
fancyvrb.sty
macros/latex/contrib/supported/fancyvrb.tar.gz
moreverb.sty
macros/latex/contrib/supported/moreverb.tar.gz
verbatim.sty
Distributed as part of macros/latex/required/tools.tar.gz