[Tex/LaTex] Is it possible to change the font of line numbers in a code listing

fontsline-numberinglistingslyx

Using LyX I can add line numbers to my code listing. However, these are in the document (serif/Roman) font and look strange next to code blocks (Typewriter font). Is it possible to change the font of the line numbers to match that of the code block? Can this be achieved using either listing parameters or some LaTeX code in the preamble?

Best Answer

The key is numberstyle:

\lstset{numberstyle=\ttfamily}
Related Question