1

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.

Thanks in advance
Alex

1
0

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:

enter image description here

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.