(Actual answer: use
Joke answer (Do not do that!)
I'll fix that for you. Here is a custom package called
fritzlistings, built on top of
listings, that uses a typewriter font by default.
[2014/09/08 v0.1 Fritz's listings]
There. Happy now?
I can't help but wince at the mutilated kerning. [...] This is also the reason I normally don't use that package at all and resort to tabulars with
If you're typesetting source code, what would be the advantage of using a
tabular environment with
\ttfamily versus using an
lstlisting environment? I can't think of any. Besides, you can configure
listings to replicate the look of a
verbatim environment (as shown in How can I make lstlisting look exactly like verbatim?), but with the nonnegligible benefit of automatic line breaking.
Why make ugly the default and make people search for a way to make it look good (which nobody seems to be bothered with, judging from the amount of papers and lecture notes containing ugly listings), instead of making it look by default?
I agree with you that the output of
listings is basic and arguably ugly, but beauty is in the eye of the beholder. What you may find beautiful, others may find ugly as f**k. I think that Carsten Heinz, the author of
listings, simply didn't want to impose any particular style on the user. In particular, you'll notice that language definitions in
lstdvrs.dtx are just that: language definitions; keys such as
keywordstyle are not used in those language definitions.
The package provides many ways of customizing the look of the output. Use them to suit your needs (I typically save my favourite styles in a custom LaTeX package), and spread the word; that will do more to improve the current state of affair than a rant.
Is there a good, technical or typographic reason to do it this way instead of using a proper monospace font (that should always be present) or at least properly using the proportional font?
I agree with you that the default
cmr don't go well together. Either
would have made more sense to me, although others would disagree about that. So why is that the default? Who knows... All I can gather from
listings.dtx is that the
basicstyle key (introduced in v0.18) predates the
columns key (v1.0). I don't have access to the full development history of the package, so I can only speculate.
My theory is that
listings' default is what it is for historical reasons. I'm guessing that
listings originally didn't tamper with the kerning at all before the inception of the
columns key in v1.0; before that,
cmr would have been an acceptable choice of font for listings. Then v1.0 came, but perhaps Carsten thought changing the default font to
cmtt at that stage would have upset existing
listings users, and he decided to stick to
Of course, only Carsten Heinz (or perhaps one of the maintainers, active or retired) could provide a conclusive rationale for this choice.
Are there other packages that do a better job at listing actual program code (not algorithms in pseudocode) by default?
Pygments-based packages, such as
pythontex, have some advantages over listings, thanks to Python; in particular,
- superior lexing/scanning capabilities,
- full Unicode support,
come to mind. However, in terms of customisation from within LaTeX (& friends) documents,
listings wins; no question about that. At least, that's the case at the moment;
minted may end up catching up with
listings, in this respect.