Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a code snippet in a beamer presentation?

What's the best way to include some code snippets in a beamer presentation?

I've already tried verbatim, and lstlisting environments - both destroyed my presentation.

like image 821
mik01aj Avatar asked Nov 06 '09 16:11

mik01aj


People also ask

Is beamer good for presentation?

Beamer is a powerful and flexible LaTeX class to create great looking presentations. This article outlines the basis steps to making a Beamer slideshow: creating the title page, adding a logo, highlighting important points, making a table of contents and adding effects to the slideshow.


2 Answers

Use the [fragile] option:

\begin{frame}[fragile]
\begin{verbatim}
...
\end{verbatim}
\end{frame}
like image 136
mkluwe Avatar answered Oct 12 '22 03:10

mkluwe


I recently used something like

\verbatiminput{blah.c}

in a beamer presentation, and it worked alright for me...

Wanna post your code?

like image 29
freedrull Avatar answered Oct 12 '22 02:10

freedrull