[Tex/LaTex] How to make lstlisting look exactly like verbatim

listingsverbatim

I like the way the verbatim environment looks, and I want to make my lstlistings look like it.

I've tried setting the basic style to \ttfamily, but the letter kerning and line spacing seem to be different. Is there any way in getting it look like verbatim?

Here is a complete example:

\documentclass[a4paper]{report}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}

\begin{document}

This is lstlisting:

\begin{lstlisting}
: paxos.learn ( addr n v -- Ethernet packet )
      2 paxos.pack32          ( addr n v -- addr payload )
      paxos.eth_type.learn    ( addr payload -- addr payload ethtype )
      swap paxos.eth_packet ; ( addr payload ethtype -- ethernet_packet )
\end{lstlisting}

This is verbatim (and what I want):

\begin{verbatim}
: paxos.learn ( addr n v -- Ethernet packet )
      2 paxos.pack32          ( addr n v -- addr payload )
      paxos.eth_type.learn    ( addr payload -- addr payload ethtype )
      swap paxos.eth_packet ; ( addr payload ethtype -- ethernet_packet )
\end{verbatim}

\end{document}

which looks like:

enter image description here

Edit

I tried setting the option columns=flexible, but then listings will ignore important spaces in the source code. 

Best Answer

Here is a way; I vastly prefer this to setting basewidth, because it doesn't box each character and doesn't need to guess whether the monospaced font uses half em character widths.

\documentclass[a4paper]{report}
\usepackage{listings}

\begin{document}

\lstset{
  basicstyle=\ttfamily,
  columns=fullflexible,
  keepspaces=true,
}
\verb|basicstyle=\ttfamily, columns=fullflexible, keepspaces=true|
\begin{lstlisting}
: paxos.learn ( addr n v -- Ethernet packet )
      2 paxos.pack32          ( addr n v -- addr payload )
      paxos.eth_type.learn    ( addr payload -- addr payload ethtype )
      swap paxos.eth_packet ; ( addr payload ethtype -- ethernet_packet )
\end{lstlisting}

This is verbatim (and what I want):

\begin{verbatim}
: paxos.learn ( addr n v -- Ethernet packet )
      2 paxos.pack32          ( addr n v -- addr payload )
      paxos.eth_type.learn    ( addr payload -- addr payload ethtype )
      swap paxos.eth_packet ; ( addr payload ethtype -- ethernet_packet )
\end{verbatim}

\end{document}

enter image description here