1

Possible Duplicate:
set the font family for lstlisting

I need to change the font while using the listings-package since my TeX template seems to interfere with standard listings settings (the code text appears in some calligraphic font which looks really stupid for source code). I already tried using basicstyle=\ttfamily as an option, but this only changes the character spaces. Is there a way to completely switch the font to e.g. Courier?

Any help appreciated, I couldn't find anything on this in the package manual or google...

EDIT: The link from Peter Grill ( set the font family for lstlisting ) solved my problem, thanks a lot! (And sorry for the duplicate!)

4
  • 2
    Welcome to TeX.SX! Would you please add a minimal example of the code you have up to now? – egreg Jun 27 '12 at 16:28
  • here is an example: tex.stackexchange.com/questions/60294/… – user2478 Jun 27 '12 at 16:30
  • Possible Duplicate: set the font family for lstlisting. Related Question: Fixed Width Font with LTXexample environment. – Peter Grill Jun 27 '12 at 17:15
  • As I see it, this is more of a font-changing issue than a listings one. If you only need the typewriter font for code, try writing \def\ttfamily{lmtt} OR \usepackage{courier} in the preamble, and then \basicstyle=\ttfamily in your listings settings. Or show us a minimal example, please. Note that if your code is in italics, Computer Modern or Latin Modern (the default fonts) are much more "calligraphic" than Courier or other mono fonts. – ienissei Jun 28 '12 at 6:52

Browse other questions tagged or ask your own question.