I would like to define a command that wraps a lstlisting
environment in some other environments (esp. a minipage). I understand that working with verbatim arguments is a difficult task. I tried the xparse
package which provides the argument type v
, but code like
\DeclareDocumentCommand{\prog}{v}{\begin{lstlisting}#1\end{lstlisting}}
does not work. Can anybody give me advice on that?
Is it any easier if I use an environment instead of a command?
lstlisting
environment cannot go in the argument of a command. It can go in aminipage
without any problem.