TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

I'm using Beamer and lstlisting to put some code in a presentation.

The character spacing feels a bit too wide to my eye. Is it possible to reduce it? I've tried searching on this SE but can't seem to see anything obvious.


This seems trivial but:

\frametitle{A frame}
the letters are too far apart
share|improve this question
Welcome to TeX.SX! Could you please add an example of what you mean? – egreg Sep 10 '12 at 14:48
Done, unless you want the complete file, \usepackage and all? – Joe Sep 10 '12 at 14:57
Try \begin{lstlisting}[columns=fullflexible] and tell whether it's better. – egreg Sep 10 '12 at 15:02
@Joe: better would be a complete example, because you can use some options loading package listings which could be important ... – Kurt Sep 10 '12 at 15:04
Thanks @egreg that is exactly what I wanted. Give it as an answer and I'll tick it. – Joe Sep 10 '12 at 15:10
up vote 5 down vote accepted

The default setting of listings is to place each character in a box in order to ensure vertical alignment emulating terminal output.

However, this may not be nice when the default font is proportionally spaced. There are two solutions (actually one):


in the document preamble will typeset in normal character boxes. However, usually listings are typeset with a monospaced font, so


will do both settings.

The key-value pair can also be specified on a local basis:


will apply the settings only to that lstlisting environment.

The key keepspaces will also avoid merging two spaces into one.

share|improve this answer
Brilliant thanks. – Joe Sep 10 '12 at 15:18

Your Answer


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.