# How do I make gb4e.sty's commands overlay aware for beamer?

I use the gb4e package to set numbered examples. I want to put these on slides made with beamer. According to the beamer userguide I can make any command overlay specification aware using this in my preamble:

\renewcommand<>{⟨existing command name⟩}[⟨argument number⟩][⟨default optional value⟩]{⟨text⟩}


I tried to do this with gb4e's \ex command. I tried the following:

\newcommand<>{\ex}[][]{\@ifnextchar [{\@ex}{\item}}


I thought that would be right, because gb4e defines \ex as follows:

\def\ex{\@ifnextchar [{\@ex}{\item}}


With that in my preamble my document doesn't compile. Am I misunderstanding something about how this works?

-
You need to surround the \renewcommand with \makeatletter/\makeatother. If you haven't done that in your document, it will fail to compile. –  Aaron May 5 '11 at 18:41
That was silly of me. Now it compiles, but hasn't made the commands overlay aware. –  Tom May 7 '11 at 17:15

Unfortunately, gb4e's example commands are more complicated than this, and are defined with delimited arguments using \def. I'm not sure that they can be made overlay aware so easily. The easiest way to uncover example items line by line is simply to use the \pause command.

\documentclass{beamer}
\usepackage{gb4e}
\resetcounteronoverlays{exx}

\begin{document}
\begin{frame}{A frame}
\begin{exe}
\ex\label{Ex1}
\begin{xlist}
\ex[]{ This is an example}
\pause
\ex[*]{This example ungrammatical is.}
\pause
\ex[]{Another one.}
\end{xlist}
\end{exe}
\end{frame}
\end{document}

-
Maybe I can't do it then. I'll just design my slides around the problem. –  Tom May 7 '11 at 17:17
The \@ifnextchar is just to define a command with optional argument. Try
\makeatletter