Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to set monospaced font for lstlisting and verbatim in Emacs? I use Emacs 23.2.1 + AUCTeX 11.86 with Tango theme.

share|improve this question
up vote 2 down vote accepted

Verbatim text is set in the face font-latex-verbatim-face, which inherits from the fixed-pitch face.

If the text is not in the right face (check with M-x describe-text-properties or “Edit / Text properties / Display properties”), there's something wrong with your AUCTeX installation (where does it come from?) or with your configuration (what happens if you run emacs -q?).

If the text is in the right face, there's something wrong with your theme. What are the parameters of the fixed-pitch face (M-x describe-face RET fixed-pitch RET)? Do you have the same problem with another theme?

share|improve this answer
This is not actually a problem, but the code looks better in lstlisting and verbatim if editor use monospaced fonts. I use Emacs on Windows Vista with Consolas font: (set-face-attribute 'default nil :font "Consolas-11") screen1. When I comment this line: screen2 but it's not monospaced font. AUCTeX come from AUCTeX-for-Windows and everything works fine. – iluzion Nov 5 '10 at 0:39
I set Text Properties for font-latex-verbatim-face on Font Family: Consolas and now looks great. Thanks Gilles! – iluzion Nov 5 '10 at 1:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .