TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. 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 can I set the basicstyle option to force the use of 9pt fonts in listings regardless of the default size of the document?

Using 9pt fonts is a requirement of the guidelines that I am using, so I must be sure that it stays that way even if I change other font settings.

share|improve this question
up vote 5 down vote accepted

Usually one sets the size of listings in a dynamic way with commands such as \small. However, nothing prevents you from using lower level commands:




The second is if you want to use the normal font also in listings. The \selectfont instruction is implicit in commands such as \ttfamily.

The second argument to \fontsize is the baseline skip to use.

share|improve this answer

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.