# How to set up two different font types for standard document and lstlisting

I try to set up my document to use the standard font for `rmfamily` and a mono font for `lstlisting`.

``````\lstset{language=C,
basicstyle=\footnotesize\ttfamily,
}
``````

In general it is not necessary to use `ttfamily`. If there an other way, it is good for me too.

Alex

So, I found a way to make my listings beautiful.

I select the Bera Mono font for the listings: http://www.ctan.org/tex-archive/fonts/bera/. The family-symbol for the Bera Mono font is `fvm`, so this is my setup:

``````\usepackage{bera} % for listings
\definecolor{lstgrey}{rgb}{0.95,0.95,0.95}
\lstset{language=C,
backgroundcolor=\color{lstgrey},
frame=single,
rulecolor=\color{lstgrey}, % make frame "invisible"
basicstyle=\footnotesize\fontfamily{fvm}\selectfont, % use Bera Mono
captionpos=t,
tabsize=2,
numberbychapter=false,
showstringspaces=false,
breaklines=true,
}
``````

This results in:

This set up has only an effect to `lstlisting` and doesn't touch the standard fonts. And a good side effect is, that the code directly can copy paste. Then I used `ttfamily` for my listings I often get additional space characters between url's, so that it was very unhandy.