
% +--------------------------------------------------------------------+
% |                                                                    |
% |  Verbatim listing macros.                                          |
% |                                                                    |
% +--------------------------------------------------------------------+
%
\newif\ifverbatimmode%
\verbatimmodefalse%
\def\|{|}%
\def\uncatcodespecials{%
   \def\do##1{\catcode`##1=12 }%
   \dospecials%
}%
%
\def\startverbatim{\catcode`\|=13}%
\def\endverbatim{\catcode`\|=12}%
\def\setupverbatim{%
   \tt%
   \def\par{\leavevmode\endgraf}%
   \catcode`\`=13%
   \obeylines%
   \uncatcodespecials%
   \obeyspaces%
}%
%
{\obeyspaces\global\let =\ }%  Let active space=control space.
{\catcode`\`=13\gdef`{\relax\lq}}%  Fix for Spanish punctuation in \tt.
%
{\catcode`\|=13%
\gdef|{%
   \relax%
   \ifverbatimmode %
      \endgroup%
      \verbatimmodefalse%
      \begingroup%
   \else%
      \verbatimmodetrue%
      \begingroup%
      \setupverbatim%
      \parindent=1in%  Set the indentation of verbatim lines.
      \parskip=0pt%  Don't put so much space between the lines.
      \begingroup\aftergroup\relax%  This makes \relax the first token
%                                    scanned after the |;  prevents
%                                    premature association of catcodes.
   \fi%
\endgroup}%
}%  Return | to its normal use.
\def\beginverbatimlisting{\par\begingroup\setupverbatim\doverbatim}
{\catcode`\|=0 \catcode`\\=12 % | is temporary escape character
  |obeylines|gdef|doverbatim^^M#1\endverbatimlisting{#1|endgroup}}
%
