6

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?

8

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.

4

\lstinputlisting obeys to the same options that are set with \lstset for the environment form. So something like

\lstset{basicstyle=\ttfamily,columns=fullflexible}

should do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.