I am using the answer here to add source code to my beamer (usually inline), as:
\usepackage{xcolor}
\definecolor{light-gray}{gray}{0.95}
\newcommand{\code}[1]{\colorbox{light-gray}{\texttt{#1}}}
But then some lines of code cannot fit to a single line, so I have to reduce the font size to fit.
Then I add a font size to the \code
command like:
\newcommand{\code}[1]{\colorbox{light-gray}{\texttt{#1}[10pt]{\fontsize{#2}{#1}\selectfont #3}}}
This doesn't work. What's the correct way of doing this?