I've been using the listings package for a while, but have only recently noticed that the underscore is rendered with less width than the other characters. I'm working on some code snippets now which use a lot of variables containing an underscore, and so I see the effect more than ever. Is there any way to prevent this?
in your preamble. The default underscore in OT1 encoding is indeed quite small.
If you don't want to switch font encoding, then the following code in the preamble will produce a similar underscore: