This post is very old. Please bear in mind that information here might be incorrect or obsolete, and links can be broken. If something seems wrong, please feel free to comment or contact me and I'll update the post.
If you are using LaTeX for presentations, you usually use the Beamer package. If you are serious about listing, you probably use the Listings package — but what if you want nice code listings in a presentation?
Actually, it’s quite easy, all you need is:
\begin{frame}[fragile]
\frametitle{Your title}
\begin{lstlisting}
code
\end{lstlisting}
\end{frame}
That’s it, and you can use all fancy formatting options inside your slides (boxes, shadows, line-numbers, etc.). Just make sure you don’t use the short-hand \frame{ ... } and that you add the [fragile] to each slide that contains a listing.
Related posts:
Pingback: MartyWiki: LaTeX HOWTO
Thanks for this tip!
Great Tip!
Thank You! Your post is very useful!
Great tip! I was going nuts!
thanks for the tip.
nice, thanks!
Thanks so much for this! Now if only the listings package supported JavaScript…
You can probably take C and add a bunch of keywords. Creating “derived” languages with lstlistings is comparatively easy.
The ‘[fragile]‘ hint saved me a lot of hassle
Great ! Thanks. Never knew about the fragile keyword
thx
works fine
thx, you saved my day