Take the 2-minute tour ×

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

1 Answer

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

Your Answer


