Possible Duplicate:
How can I put lstlisting block into subfloat block?
Running this code gives me an error that ! Paragraph ended before \lst@next was complete.
\begin{figure}
\subfloat[subcaption 1]{
\begin{lstlisting}
text here
\end{lstlisting}
}
\hspace{80pt}
\subfloat[subcaption 2]{
\begin{lstlisting}
text here
\end{lstlisting}
}
\caption{Global caption}
\end{figure}
I want to display code side by side
\lstset{language=[Sharp]C}. See thelistingsdocumentation (p 11-12, section 2.4 Programming languages). Note that some settings are possible via the optional argument to\lstinputlisting, but some are not and are best set via\lstset. – Werner Apr 02 '12 at 20:00