# In Beamer, how to use pgfkeys to pass parameter to enumerate?

I want to create a new environment with one optionnal parameter that is used to set pgfkeys. I want one key to be pass as argument too enumerate to make item appears one at a time (<+->). It seems that enumerate takes that argument as the style of the counters (alph, arabic, roman,...). Is it an expansion problem? Is enumerate looking for a special caracter? What I'm I doing wrong? I also tried with l3keys and got the same problem.

\documentclass{beamer}
\usepackage{xparse}
\usepackage{pgfplots}
\usepackage[T1]{fontenc}  %%% without that the < > appear as inversed ! and ?

\pgfkeys{
/enume/.is family, /enume,
default/.style =
{opt = empty},
opt/.estore in = \theopt,
}

\NewDocumentEnvironment {myenum} {o} {%
\pgfkeys{/enume, default, #1}%
The key value is : \theopt

%\begin{enumerate}[<+->]    % with this line it is working  (but it doesn't use the parameter)
\begin{enumerate}[\theopt]  % with this line it is not working
}{%
\end{enumerate}
}%

\begin{document}
\begin{frame}
\begin{myenum}[opt={<+->}]
\item I have a cat.

\item It is blue.
\end{myenum}
\end{frame}
\end{document}


The enumerate wants to see an explicit < so we need to expand the argument first.

\documentclass{beamer}
\usepackage{xparse}
\usepackage{pgfplots}
\usepackage[T1]{fontenc}  %%% without that the < > appear as inversed ! and ?

\pgfkeys{
/enume/.is family, /enume/.cd,
default/.style =
{opt = empty},
opt/.estore in = \theopt,
}

\NewDocumentEnvironment {myenum} {o} {%
\pgfkeys{/enume, default, #1}%
The key value is : \theopt

%\begin{enumerate}[<+->]    % with this line it is working  (but it doesn't use the parameter)
\edef\temp{\noexpand\begin{enumerate}[\theopt]}  % with this line it is not working
\temp
}{%
\end{enumerate}
}%

\begin{document}
\begin{frame}
\begin{myenum}[opt={<+->}]
\item I am owned by a cat.

\item They are blue.
\end{myenum}
\end{frame}
\end{document}


• Thank you very much! Sep 12 '19 at 16:19