verbatim environment uses the fixed-width
\ttfamily font, turns
blanks into spaces, starts a new line for each carriage return (or
sequence of consecutive carriage returns), and interprets every
character literally. I.e., all special characters
$, etc. are
\catcode'd to "other".
\verb produces in-line verbatim
text, where the argument is delimited by any pair of characters. E.g.,
\verb #...# takes "..." as its argument, and sets it verbatim in
\ttfamily font. The
*-variants of these commands are the same, except
that spaces print as the TeXbook's space character instead of as blank
In particular, the character used to delimit the contents of
\verb cannot appear in the verbatim text. Additionally,
\verb is meant for in-line verbatim expressions and doesn't admit carriage returns as
verbatim does; a carriage return inside
\verb triggers the error
! LaTeX Error: \verb ended by end of line.
verbatim environment always starts and ends with a new line.
verbatim applies a series of additional precautions; for example, a previous use of
\parshape won't affect the contents of the verbatim environment.