remove double spacing inside {verbatim}

Look at using fancyvrb. It has a lot of nice tricks. But in particular, you can set the baselineskip within the verbatim environment:

\documentclass{uwthesis}
\usepackage{fancyvrb}
\begin{document}

Double \\
Spaced \\
Lines

\begin{Verbatim}[baselinestretch=0.75]
These
lines
are
also
doublespaced
\end{Verbatim}
\end{document}

0.75 might be a bit tight for you.

enter image description here


You can use the etoolbox package to change \baselinestretch from 1.5 (the default in uwthesis.cls) to 1:

\documentclass{uwthesis}
\usepackage{etoolbox}

\BeforeBeginEnvironment{verbatim}{\def\baselinestretch{1}}

\begin{document}

Double \\
Spaced \\
Lines

\begin{verbatim}
These
lines
are
not
doublespaced
\end{verbatim}

Double \\
Spaced \\
Lines

\end{document}

enter image description here


You can update the verbatim font to use a different \linespread. More specifically, include \linespread{1} as part of \verbatim@font:

enter image description here

\documentclass{uwthesis}% http://ctan.org/pkg/uwthesis
\makeatletter
\def\verbatim@font{\linespread{1}\normalfont\ttfamily}
\makeatother
\begin{document}

Double \\
Spaced \\
Lines

\begin{verbatim}
These
lines
are
not
doublespaced
\end{verbatim}

Double \\
Spaced \\
Lines
\end{document}

The uwthesis class relies on the default LaTeX kernel verbatim environment, hence the ease of not having to add extra packages to obtain a desired output. For a reference to \linespread, see Why doesn’t \linespread work? on the UK TeX FAQ.

You could contain the redefinition in a macro that would act as a switch:

\makeatletter
\newcommand{\nextverbatimspread}[1]{%
  \def\verbatim@font{%
    \linespread{#1}\normalfont\ttfamily% Updated definition
    \gdef\verbatim@font{\normalfont\ttfamily}}% Revert to old definition
}
\makeatother

which you could use in the form

\nextverbatimspread{1}
\begin{verbatim}
% ...single-spaced verbatim
\end{verbatim}
% ...some other content
\begin{verbatim}
% ...double-spaced verbatim
\end{verbatim}

For creating your own verbatim-like environment is a little more tricky. The easiest would be to include the verbatim package and use David's suggestion of wrapping the verbatim environment in command-form:

enter image description here

\documentclass{uwthesis}% http://ctan.org/pkg/uwthesis
\usepackage{verbatim}% http://ctan.org/pkg/verbatim
\makeatletter
\newcommand{\nextverbatimspread}[1]{%
  \def\verbatim@font{%
    \linespread{#1}\normalfont\ttfamily% Updated definition
    \gdef\verbatim@font{\normalfont\ttfamily}}% Revert to old definition
}
\newenvironment{myverbatim}[1][1.5]
  {\def\verbatim@font{%
     \linespread{#1}\normalfont\ttfamily% Updated definition
     \gdef\verbatim@font{\normalfont\ttfamily}}% Revert to old definition
   \verbatim}
  {\endverbatim}
\makeatother
\begin{document}

Double \\
Spaced \\
Lines

\nextverbatimspread{1}
\begin{verbatim}
These
lines
are
not
doublespaced
\end{verbatim}

Double \\
Spaced \\
Lines

\begin{myverbatim}
These
lines
are
doublespaced
\end{myverbatim}

Double \\
Spaced \\
Lines

\begin{myverbatim}[1]
These
lines
are
not
doublespaced
\end{myverbatim}
\end{document}

The myverbatim environment takes an option argument to specify a modified \linespread. The default is 1.5, as specified by uwthesis ("not quite doublespaced", according to uwthesis.cls, line 158).