Font for programming source code using LaTeX

The listing style is usually used to list the source code, but for me the default font used is not so good for listing the source code. A comparison is made between listing and verbatim.

http://img27.imageshack.us/img27/8906/screenshot20100717at115.png

  • How can I use a font for literal use when I use the listing environment?
  • What would be a good font for a list of source code?
+7
latex listings
source share
2 answers

I agree that the default listings are not so attractive. I usually write something like

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

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

The columns=fullflexible suppresses the listing, which makes the text with a proportional width fit into a monospaced grid; it is not necessary if you choose a monospace font to start with.

+13
source share

Have you tried \ texttt? This is a family of teletypes, a font of fixed width. He should look better.

+3
source share

All Articles