# [texhax] Verbatim environment in LaTeX

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Thu Aug 26 15:04:57 CEST 2004

>   I'm trying to reduce the size of the text inside a verbatim
>   environment in order to stop the display of some regression results
>   spilling across into the right margin. Verbatim is needed because
>   the maths symbols etc freak out LaTeX.

i find it hard to imagine what maths symbols you can't put in
"ordinary" latex, that you can put in verbatim.  in general, (la)tex
deals with maths, whereas most other systems (plain text included)
just don't.

>   I've tried redefining the verbatim environment but without success.
>   So I've then tried creating a new verbatim environment, but that
>   doesn't work either. Any advice would be most appreciated.
>
>   My command, in the preamble:
>
>   \newenvironment{myverbatim}{\small\begin{verbatim}}{\end{verbatim}\normalsize}

to first order, you can't do anything with verbatim in the argument of
a command.  even if that command is \newenvironment.  (your command
wouldn't work, anyway, since the \small would affect the \baselineskip
of the text immediately before it.)

there are exceptions to the rule about verbatim, of course, but you
don't need them.  the fancyvrb package does pretty much everything
anyone could want of verbatim, not limited to mere size changes.