I want to run a command (writing page ranges to a file) at the end of each frame.
I can capture the page the frame started with at the beginning with \AtBeginEnvironment{frame}{\global\edef\framebeginpage{\thepage}}.
But if I try to write the page range at the end of the frame, it does not work:
It seems that \AtEndEnvironment{frame}{\immediate\write\notesfile{\framebeginpage-\thepage}} doesn't get executed.
Is there anything I can do instead?
MMWE:
\documentclass{beamer}
\usepackage{etoolbox}
\newwrite\notesfile
\AtBeginEnvironment{frame}{\global\edef\framebeginpage{\thepage}}
\AtEndEnvironment{frame}{\immediate\write\notesfile{\framebeginpage-\thepage}}
\begin{document}
\immediate\openout\notesfile=frames.txt
\immediate\write\notesfile{Begin}
\begin{frame}
\begin{itemize}[<+->]
\item foo
\item bar
\item baz
\end{itemize}
\end{frame}
\begin{frame}
\begin{itemize}[<+->]
\item foo
\item bar
\item baz
\end{itemize}
\end{frame}
\immediate\write\notesfile{End}
\immediate\closeout\notesfile
\end{document}
wframebehave asframewith respect to the optional and "mandatory" arguments? – Gonzalo Medina Feb 03 '15 at 19:30\begin{wframe}definition AND 2)wframeis defined with 0 arguments. Thus, when\begin{frame}is called at the end of\begin{wframe}, I think its arguments will be waiting for it in the input stream. – Steven B. Segletes Feb 03 '15 at 19:34