Ceci est une ancienne révision du document !
Comment inclure un fichier verbatim?
Un bon moyen est d'utiliser l'extension verbatim de Rainer Schöpf,
qui fournit une commande \verbatiminput
, qui prend un nom de fichier comme argument :
\usepackage{verbatim} ... \verbatiminput{verb.txt}
Une autre méthode consiste à utiliser l'environnement alltt
, de l'extension alltt.
L'environnement insère son contenu essentiellement en mode verbatim, mais exécute tout de même
toutes les commandes (La)TeX qu'il trouve :
\usepackage{alltt} ... \begin{alltt} \input{verb.txt} \end{alltt}
Bien sûr, cela n'est guère utile pour saisir du code source (La)TeX…
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.