# Moving from fancyvrb to listing – need to reconstruct my font settings

I have happily used the fancyvrb package with the Verbatim environment so far, but I want to change my figures to use the listing package with the lstlisting environment in order to have bold-faced keywords which improve readability.

Unfortunately, I have no clue to adjust the listing settings to get the same (very nice) font I had before with fancyvrb...

Here is my fancy verb settings:

% fancy verb
\usepackage[T1]{fontenc}
\usepackage{fancyvrb}
\usepackage{relsize}
\fvset{fontfamily=fvm}
\fvset{fontsize=\relsize{-2}}
\fvset{baselinestretch=1.3}


And here for listings, using the Scala language:

% listings
\usepackage{listings}
\lstdefinelanguage{scala}{ % "define" Scala
morekeywords={abstract,case,catch,class,def,do,else,extends,false,final,%
finally,for,if,implicit,import,match,mixin,new,null,object,override,package,%
private,protected,requires,return,sealed,super,this,throw,trait,true,try,%
type,val,var,while,with,yield},
otherkeywords={=>,<-,<\%,<:,>:,\#,@},
sensitive=true,
morecomment=[l]{//},
morecomment=[n]{/*}{*/},
morestring=[b]",
morestring=[b]',
morestring=[b]"""
}
\lstset{ % activate the language and predefine settings
language=scala,%
columns=[c]fixed,%
keepspaces=true,%
basewidth={0.58em, 0.53em},%
tabsize=2,%
basicstyle=\renewcommand{\baselinestretch}{0.95}\ttfamily,%
keywordstyle=\bfseries,%
mathescape=true,%
escapechar=€,%
captionpos=b,%
framerule=0.3pt,%
firstnumber=0,%
numbersep=1.5mm,%
numberstyle=\tiny,%
}


And here is the document body contrasting both:

\documentclass{article}
% ... paste the fancy verb and listing settings from above here
\begin{document}

\begin{Verbatim}
object Stream {
def cons[A](hd: A, tl: => Stream[A]) = new Stream[A] {
def head = hd
lazy val tail = tl
...
}
}
\end{Verbatim}

\begin{lstlisting}
object Stream {
def cons[A](hd: A, tl: => Stream[A]) = new Stream[A] {
def head = hd
lazy val tail = tl
...
}
}
\end{lstlisting}

\end{document}


Neither does the font of listing look remotely like the T1/fancyvrb one, nor does LaTeX seem to pay attention to setting the keywords in bold-face:

I guess I need to change the basicstyle entry, but how?

-
Just a short note: Did you notice, that you can use listings together with fancyvrb? See the according section in documentation of listings. –  Speravir Mar 3 '13 at 22:37
@Speravir Perfect, can you post that as an answer, then I will accept! –  Emit Taste Mar 3 '13 at 22:44
Much better: Provide a self-answer with all bells and whistles. –  Speravir Mar 3 '13 at 22:45

Ok, so this actually the answer of @Speravir :)

All that is needed is the following listing settings:

\lstset{
language=scala,%

Then everything already set in \begin{Verbatim}...\end{Verbatim} benefits from the keyword and comment highlighting.
One should read the section “Interface to fancyvrb” in the listings documentation for respective caveats. –  Speravir Mar 3 '13 at 22:51