[Tex/LaTex] How to change the font style and size for the \lstinputlisting

fontslistings

I am trying to insert some piece of code into my document, using the \lstinputlisting command. However the fonts displayed do not look too good. Is it possible to change the font size and style?

Best Answer

You can use the optional argument to provide any listings options:

\lstinputlisting[basicstyle=\ttfamily\scriptsize,language=somelang]{filename}

For multiple listings you can set this settings globally (or locally to the current group) using \lstset{<options>}. See the listings manual for more details. https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings

Related Question