UK TeX FAQ -- question label verbfile

### Including a file verbatim in LaTeX

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

>     \usepackage{verbatim}
>     ...
>     \verbatiminput{verb.txt}

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 finds:

>     \usepackage{alltt}
>     ...
>     \begin{alltt}
>     \input{verb.txt}
>     \end{alltt}

of course, this is little use for inputting (La)TeX source code...

The moreverb package extends the 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 package's `listing` environment and the `\``listinginput` command also both honour TAB).

The sverb package provides verbatim input (without recourse to the facilities of the verbatim package):

>     \usepackage{sverb}
>     ...
>     \verbinput{verb.txt}

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.

The memoir class includes the relevant functionality of the verbatim and moreverb packages.

`alltt.sty`
  Part of the LaTeX distribution.
`fancyvrb.sty`
  macros/latex/contrib/fancyvrb (zip, browse)
`memoir.cls`
  macros/latex/contrib/memoir (zip, browse)
`moreverb.sty`
  macros/latex/contrib/moreverb (zip, browse)
`sverb.sty`
  Distributed as part of macros/latex/contrib/mdwtools (zip, browse)
`verbatim.sty`
  Distributed as part of macros/latex/required/tools (zip, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile