views:

251

answers:

1

Hi,

I'm trying to add some code in a presentation made with LaTex. I used beamer, added some frames without problems but once I add the listing, I can't compile the presentation anymore.

\begin{frame}{Code}
\begin{lstlisting}
Sample Code
\end{lstlisting}
\end{frame}

The error I pdflatex gave me is:

Package Listings Warning: Text dropped after begin of listing on input line 80.

Is there anything special to add to make it work ?

Thanks

+3  A: 

Try making a fragile frame:

\begin{frame}[fragile]
johanbev
No sorry, it doesn't compile either. Still the same error. :-(
Valdor65
Strange, I cannot reproduce your behaviour. I guess really long lines in the listing could break it. Other culprits may be the theme used with beamer or packages not installed properly.
johanbev
Sorry, it works, I retried it : You have to add the [fragile] before the title :\begin{frame}[fragile]{Frame Title}
Valdor65