0

I would like to create a command that ends a beamer frame. However, this leads to the error message quoted below - probably due to the same problem that prevents indentation of frame commands, cf. Indenting \end{frame} in fragile slides.

The error message is: ! File ended while scanning use of \next.

Below is a failing MWE that can be made working by commenting out \end{frame} in the definition of \pfooter plus uncommenting it at the bottom.

\documentclass[english,10pt]{beamer}

\usepackage{listings}

\newcommand{\pheader}[1]{%
    \section{bla: blabla}
    \begin{frame}[fragile]{blabla}
}

\newcommand{\pfooter}{\end{frame}
    % some other commands
}

\begin{document}
\pheader{}
  \begin{lstlisting}[gobble=4]
    1234567890
  \end{lstlisting}

  bla
\pfooter{}
% \end{frame}
\end{document}
stefanct
  • 841
  • 6
  • 16

0 Answers0