[Tex/LaTex] set the font family for lstlisting


I have the following set up for my listings :


I would like to change the font family to Courier. How can I enable this?

Best Answer

With \usepackage{courier} in your preamble you can use the courier font in the listings as follows:



   a b c

The \usepackage{courier} in the preamble causes \ttfamily to produce output in the courier font. Without including this package, you can still use \ttfamily to get a mono spaced font by including that as part of the basicstyle=... setting.

Related Question