[Tex/LaTex] How to set a font size smaller than \tiny in lstlisting

beamerfontsizelistings

I'm writing a presentation using LaTeX and beamer. In some slides I put an image and some code using the listings package and the lstlisting environment. I'd like to use a font size smaller than \tiny for the codes. How can I set that?

Thank you in advance for the answers.

Best Answer

You can define (for ease of use and re-use) a \srcsize command that sets an arbitrary font size (here 5pt for example)

\makeatletter
\newcommand{\srcsize}{\@setfontsize{\srcsize}{5pt}{5pt}}
\makeatother

and then in the style, you can use to set the size for the basic style:

basicstyle={\ttfamily\srcsize}

(adapt for other font families)