This recent question tickled my curiosity on etoolbox (that looks great but that I have actually never used).
After a quick check, I don't read any notorious incompatibility between etoolbox and beamer.
Where am I wrong when I try this ? Must be silly...
%\documentclass{memoir}
%\documentclass{article}
\documentclass{beamer}
\usepackage{etoolbox}
\usepackage{tikz}
% This works fine
%\BeforeBeginEnvironment{tikzpicture}{\begin{center}}
%\AfterEndEnvironment{tikzpicture}{\end{center}}
% It generates an error
%\BeforeBeginEnvironment{tikzpicture}{\begin{frame}}
\BeforeBeginEnvironment{tikzpicture}{ \begin{frame} \frametitle{My TikZ} }
\AfterEndEnvironment{tikzpicture}{ \end{frame} }
\begin{document}
\begin{tikzpicture}
\node[circle,draw=red] {Test};
\end{tikzpicture}
\end{document}
\end{frame}explicitly in the document – David Carlisle Dec 08 '21 at 20:34\BeforeBeginEnvironment{tikzpicture}{\begin{frame}[environment=tikzpicture]\frametitle{My TikZ}}(though I'm not sure it's a good idea to make alltikzpictures do a frame...) – Phelype Oleinik Dec 08 '21 at 21:26Incomplete \ifx? – JeT Dec 08 '21 at 22:22environmentoption works when you do\newenvironment{myenv}{\begin{frame}[environment=myenv]}. It doesn't work when you use environment hooks (and I think it's not possible to make it work). – Phelype Oleinik Dec 08 '21 at 23:53