views:

87

answers:

2

Listing style is normally used for source code listing, but to me the default font used is not so pretty for source code listing. Attached is a comparison between listing and verbatim.

  • How can I use the font for verbatim when I use listing environment?
  • What would be a good font for source code listing?
+1  A: 

Did you try \texttt? It's the teletypefont family, a fixed-width font. It should look better.

Vitor Py
+6  A: 

I agree the defaults of listings aren't that appealing. Usually I write something like

\lstset{columns=fullflexible,basicstyle=\ttfamily}

You might also need to play around with the identifierstyle, commentstyle, etc., keys if the style for your code uses these separately.

The columns=fullflexible keyval suppresses listings's layout thing that it does to make proportional-width text fit into a monospace grid; it's not necessary if you choose a monospace font to begin with.

Will Robertson