# Shrinking monospace style for listings package

I am working on a thesis and putting together a "pretty" listing. I'm looking at setting up a small font style for a code view. What I have here is:

\usepackage{listings}
\lstset{language=C,
numberstyle=\footnotesize,
basicstyle=\footnotesize,
numbers=left,
stepnumber=1,
breaklines=true}
%\usepackage[subsection]{placeins}
\usepackage{float}


But this comes out in a typical kerned font, vs. I am looking for smaller monospace, say, 10 points or so.

-
Welcome to TeX.sx! Usually you should add a full minimal working example (MWE) that illustrates your problem. Then we can see what packages you are using etc. Here the \lstset seems to be enough, however. – Martin Scharrer Oct 29 '11 at 6:56
@MartinScharrer: Thanks! I will remember. – Paul Nathan Oct 29 '11 at 17:11

basicstyle=\footnotesize\ttfamily,


or with package microtype

\usepackage[T1]{fontenc}
\usepackage[scaled]{beramono}
\newcommand\Small{\fontsize{9}{9.2}\selectfont}
\newcommand*\LSTfont{\Small\ttfamily\SetTracking{encoding=*}{-60}\lsstyle}
...
\begin{lstlisting}[basicstyle=\LSTfont,...]
...


Which gives a better result.

-

You are missing a \ttfamily in the basicstyle. If this doesn't give you the size you want try \scriptsize or even \tiny instead of \footnotesize. You don't need to add the same size for the numberstyle again because basicstyle is used for everything by default.

\documentclass{article}
\usepackage{listings}
\lstset{language=C,
numberstyle=\footnotesize,
basicstyle=\ttfamily\footnotesize,
numbers=left,
stepnumber=1,
breaklines=true}

\begin{document}
Normal text

\begin{lstlisting}
int a, b, c;
b = 2;
c = b++;
a = b + c;
\end{lstlisting}

Normal text
\end{document}

-
 scriptsize worked for me, because it's between tiny and footnote size. it was the best trade off. – OneWorld Oct 8 '12 at 8:27