# Change in \lstdefinelanguage the font?

Im using \lstdefinelanguage to add some new languages. Now everything is fine, I just would like to add another font to my language. I would like to use inconsolata.

I have now this:

%...
\usepackage{inconsolata}
\lstdefinelanguage{Scala}
{
%...
basicstyle=\small %what else do i have to add to use inconsolata?
}


Any ideas? Thanks

-

Just loading the inconsolata package, the monospaced font is redefined, so it's enough to add \ttfamily (you could also access the font using \fontfamily{fi4}\selectfont):

\documentclass{article}
\usepackage{listings}
\usepackage{inconsolata}
\lstdefinelanguage{Scala}
{
%...
basicstyle=\ttfamily\small
}
\begin{document}

\begin{lstlisting}[language=Scala]
object HelloWorld {
def main(args: Array[String]) {
println("Hello, world!")
}
}
\end{lstlisting}

\end{document}


-
Thank you, this is working. Im just asking myself why "fi4"? And also, how to add the same font in a bold format? –  LissyA Oct 6 '12 at 18:38
Shouldn't basicstyle=\ttfamily\small suffice? –  cgnieder Oct 6 '12 at 18:41
@LissyA unfortunately the inconsolata package doesn't offer a bold version of the font. –  Gonzalo Medina Oct 6 '12 at 18:41
@cgnieder you're absolutely right; I'll edit the answer. Thank you. –  Gonzalo Medina Oct 6 '12 at 18:42