\documentstyle[verbatim]{article}
 
\newenvironment{myverbatim}{\endgraf\noindent MYVERBATIM:\endgraf
                            \verbatim}{\endverbatim}
 
\newenvironment{verbatimlisting}[1]%
 {\verbatim\noexpand\input{#1}}{\endverbatim}
 
\makeatletter
 
\newwrite\verbatim@out
 
\newenvironment{verbatimwrite}[1]%
 {\@bsphack
  \immediate\openout \verbatim@out #1
  \let\do\@makeother\dospecials\catcode`\^^M\active
  \def\verbatim@processline{%
    \immediate\write\verbatim@out{\the\verbatim@line}}%
  \verbatim@start}{\immediate\closeout\verbatim@out\@esphack}
 
\makeatother
 
\begin{document}
 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
  \begin{verbatim}
    test
    \end{verbatim*}
    test
    \end{verbatim
    test of ligatures: <`!`?`>
    \endverbatim
    test
    \end  verbatim
    test
  \end{verbatim} Further text to be typeset: $\alpha$.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
  \begin{verbatim*}
    test
    test
  \end {verbatim*}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
  \begin{verbatim*}  bla bla
    test
    test
  \end {verbatim*}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
 
First of Chris Rowley's fiendish tests:
\begin{verbatim}
the double end test<text>
\end\end{verbatim}  or even \end \end{verbatim}
%
%not \end\ended??
%\end{verbatim}
 
Another of Chris' devils:
\begin{verbatim}
the single brace test<text>
\end{not the end\end{verbatim}
%
%not \end}ed??
%\end{verbatim}
Back to my own tests:
  \begin{myverbatim}
    test
    test
  \end {myverbatim} rest of line
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
  \begin {verbatimlisting}{verbtest.tst}
    Additonal verbatim text
      ...
  \end{verbatimlisting}
And here for listing a file:
  \verbatiminput{verbtest.tst}
And again, with explicit spaces:
  \verbatiminput*{verbtest.tst}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
  \begin{comment}
    test
    \end{verbatim*}
    test
    \end {comment
    test
    \endverbatim
    test
    \end  verbatim
    test
  \end {comment} Further text to be typeset: $\alpha$.
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
  \begin{comment}  bla bla
    test
    test
  \end {comment}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text
 
\begin{verbatimwrite}{verbtest.txt}
asfa<fa<df
sdfsdfasd
asdfa<fsa
\end{verbatimwrite}
 
\end{document}
 
