I use the following settings for my listings:
\lstset{
%basicstyle=\ttfamily\tiny, % small
basicstyle=\ttfamily\scriptsize, % middle
}
But the font in the listings is too bold for me. I tried a lot of things, but I couldn't change it.
I want to use a monospace (fixed) font in my listings, is there any other font I could use?
PS: I compile my tex files with a xelatex compiler.
EDIT #2:
Complete example:
\documentclass[12pt,german,a4paper]{scrreprt}
\usepackage{xltxtra}
\usepackage{lmodern}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{listings}
\begin{document}
\lstset{
basicstyle=\ttfamily\scriptsize, % bold and monospace
%basicstyle=\scriptsize, % not bold and not monospace
}
\pagestyle{plain}
\begin{lstlisting}
cntNodes++;
nodes = (DG_NODE_ID *) realloc(nodes, cntNodes * sizeof (DG_NODE_ID));
if (nodes == NULL) {
fprintf(stderr, "Error: No memory left!\n");
return false;
} /* if */
\end{lstlisting}
\end{document}
Best Answer
scale down the monospace font or use flexible colums or define a smaller letter space (see package fontspec). SourceCodePro is part of TL2012.