Problem
I want to explain C# programming language step by step using overlay in beamer.cls
. But it does NOT works as shown in the following figure.
How to solve this problem?
Code Snippet
\documentclass[dvipsnames,cmyk]{beamer}
\usepackage{listings}
\begin{document}
\defverbatim[colored]\Lst{%
\begin{lstlisting}[language={[Sharp]C}]
using System;
public delegate void Foo(object o);
\uncover<1>{public class Foo}
\uncover<2>{\{}
\uncover<3>{public static void Main()}
\end{lstlisting}}
\begin{frame}{MyListing}
\Lst
\end{frame}
\end{document}
Best Answer
use the
semiverbatim
environment, it is more flexible in this case. Here is an example how I did it some time ago:If you have a lot of TeX code to show then define something like
then it easier to write something like \Lcs{newpage}.