Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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