# looking for monospaced condensed font

I am looking for condensed mono spaced (typewriter) fonts to typeset program listings with pdflatex. The fonts should have the common shapes (up and italic or slanted) and series (normal and bold). Any suggestions?

-
By "typewriter" font, I assume you mean monospaced, right? Separately, will you be running pdflatex, xelatex, or lualatex? –  Mico Mar 10 '12 at 3:50
@Mico Yes, I mean mono spaced fonts. I will be running pdflatex. –  Romildo Mar 10 '12 at 8:38

Latin Modern ha a condensed version of the typewriter font:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{lipsum}

\begin{document}
\ttfamily\lipsum[1]

\fontseries{lc}\selectfont
\lipsum[1]

\end{document}


If you need the text justified, you have to modify the \fontdimenX values

-

I do not know any free fonts satisfying your requirements. If you can consider non free fonts. I would recommend The Sans Mono Condensed Font designed by Lucas de Groot specifically for typesetting program code: http://www.lucasfonts.com/fonts/thesansmono/thesansmono-condensed/. Years ago I wrote LaTeX support package for it: http://www.ctan.org/pkg/thsmc. Of course XeTeX can use this font directly.

-

Instead of looking for condensed fonts, you can also just change the size of the default font. I find that Latin Modern in \footnotesize looks quite good in listings:

\documentclass{article}

\usepackage{lmodern}
\usepackage{lipsum}
\usepackage{listings}

\lstset{%
basicstyle=\footnotesize\ttfamily,%
numbers=left,%
numberstyle=\footnotesize,%
tabsize=2%
}

\begin{document}

\lipsum[1]

\begin{lstlisting}[language=C]
#include <stdio.h>

int main(void)
{
printf("Hello World!\n");
}
\end{lstlisting}

\end{document}


Latin Modern typewriter font has normal and bold series, but the difference is subtle. You can try passing the lighttt option to the lmodern package for more distinction.

You can also browse The LaTeX Font Catalogue.

-

There is beramono:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[scaled=.83]{beramono}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
\ttfamily\lipsum[1]

\end{document}

-