\documentstyle[12pt]{report}
{\catcode`@=11 %make @ a character for the nonce
%       ****************************************
%       *              VERBATIM                *
%       ****************************************
%
%  The verbatim environment uses the fixed-width \tt font, turns blanks into 
%  spaces, starts a new line for each carrige return (or sequence of 
%  consecutive carriage returns), and interprets EVERY character literally.
%  I.e., all special characters \, {, $, etc. are \catcode'd to 'other'.
%
%  The command \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 \tt font.
%
%  The *-variants of these commands is the same, except that spaces
%  print as the TeXbook's space character instead of as blank spaces.

{\catcode`\^^M=13 \gdef\@gobblecr{\@ifnextchar
{\@gobble}{\ignorespaces}}}

{\catcode`\ =\active\gdef\@vobeyspaces{\catcode`\ \active \let \@xobeysp}}
 
\def\@xobeysp{\leavevmode{} }

\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@xverbatim#1\end{verbatim}[#1|end[verbatim]]
|gdef|@sxverbatim#1\end{verbatim*}[#1|end[verbatim*]]
|endgroup

\def\@sverbatim{\obeyspaces\@verbatim}

\def\@gobble#1{}

\def\@verbatim{
leftskip\-0.5in \rightskip-0.5in %new line
\trivlist \item[]\if@minipage\else\vskip\parskip\fi
% old line \leftskip\@totalleftmargin\rightskip\z@
% old line \parindent\z@\parfillskip\@flushglue\parskip\z@
\@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par}
\obeylines \tt\footnotesize \let\do\@makeother \dospecials}

\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces \@xverbatim}
\let\endverbatim=\endtrivlist

\@namedef{verbatim*}{\@verbatim\@sxverbatim}
\expandafter\let\csname endverbatim*\endcsname =\endtrivlist


\def\@makeother#1{\catcode`#112\relax}

\def\verb{\begingroup \tt\footnotesize \let\do\@makeother \dospecials 
\@ifstar{\@sverb}{\@verb}}

\def\@sverb#1{\def\@tempa ##1#1{##1\endgroup}\@tempa}

\def\@verb{\obeyspaces \frenchspacing \@sverb}
} %return @ to its former code
\textwidth=6.6in
\begin{document}
\pagestyle{headings}
% 
\section{Typing Expressions}

The previous section ``Getting Started'' explained what to do to get to the first command prompt on your computer.
We assume you are now faced with a display something like this:

\begin{verbatim}
\% Macsyma 
{\em some text}
(c1)
\end{verbatim}
Suppose you wanted to work with the expression $ ( x+1)^{3}$.
You could type it in by using Fortran-style syntax as follows:
%this is what verbatim does...
\begin{verbatim}
(c1) (x+1)**3;
\end{verbatim}
% note: the ^ confuses things, and has to be escaped. Ditto %
\begin{verbatim}
(c35) x/(x^3+1);
                                      x
(d35)                               ------
                                     3
                                    x  + 1

(c36) integrate(%,x);
                                        2 x - 1
                      2            atan(-------)
                 log(x  - x + 1)        sqrt(3)    log(x + 1)
(d36)            --------------- + ------------- - ----------
                        6             sqrt(3)          3
\end{verbatim}
\end{document}