I know how to customize the caption format of a lstlisting
environment.
But how to do this if I used the \lstinputlisting
command to import code?
My document contains the snippet below.
\begin{framed}
\lstinputlisting[label=samplecode,caption=sample code,language=python]{sample.py}
\end{framed}
Best Answer
You can use the package
caption
for customization your output.The modification can be done for
lstlisting
with the commandcaptionsetup
.Here the font is set to small and typewriter family is used.
Please have a closer look at the manual. Here a complete example: