0

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

  • 2
    Does this help? http://tex.stackexchange.com/questions/34946/how-can-i-put-lstlisting-block-into-subfloat-block/34949#34949 – Torbjørn T. Apr 02 '12 at 19:02
  • Well, I tried to put the code myself in a file by \lstinputlisting{filename} and it works but how can I specify that the filname code has C# code? – user972616 Apr 02 '12 at 19:12
  • 1
    You can specify the language using \lstset{language=[Sharp]C}. See the listings documentation (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

0 Answers0