This answer
scaling latex objects
advises to use \resizebox
to scale Latex objects.
However, this approach fails when rescaling a listing in beamer:
\documentclass{beamer}
\usepackage{listings}
\begin{document}
\begin{frame}[fragile]
\resizebox{\textwidth}{!}{%
\begin{lstlisting}
some -program --code "Not fitting into page"
\end{lstlisting}
}
\end{frame}
\end{document}
The error one gets is
! Argument of \lst@next has an extra }.
How to scale a listing in beamer?
Best Answer
As said in the comment you cannot pass verbatim stuff as arguments to a macro. But for
listings
you can easily change the font size.If you want to change it for the document or a complete frame you can use
lstset
.