
% macros for verbatim scanning
\chardef\other=12
\def\ttverbatim{\begingroup
\parindent=0pt
\def\par{\leavevmode\endgraf}%leave blank lines alone in verbatim
  \catcode`\\=\other \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other
  \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
  \catcode`\_=\other \catcode`\^=\other \catcode`\^^A=\other \catcode`\^^K=\other
  \catcode`\^^M=\other\obeyspaces\obeylines\fixspace\tt}
\outer\def\begintt{$$
%\let\par=\endgraf 
\ttverbatim \parskip=\z@
  \catcode`\|=0  \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
\catcode`\|=\active
{\obeylines\gdef|{\ttverbatim\let|=\endgroup}}
{\catcode`\ =\active
\gdef\fixspace{\catcode`\ =\active\def {~}}}
  


.
