mik01aj
mik01aj

Reputation: 12372

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.

Upvotes: 19

Views: 29013

Answers (2)

mkluwe
mkluwe

Reputation: 4061

Use the [fragile] option:

\begin{frame}[fragile]
\begin{verbatim}
...
\end{verbatim}
\end{frame}

Upvotes: 27

freedrull
freedrull

Reputation: 2254

I recently used something like

\verbatiminput{blah.c}

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

Wanna post your code?

Upvotes: 3

Related Questions