6

The following MWE does not compile with beamer 2017/07/13 v3.42 from TeXLive 2017-20170807:

\documentclass{beamer}

\begin{document}
\begin{frame}[fragile]
  \begin{verbatim}
    \end{frame}
  \end{verbatim}
\end{frame}
\end{document}

The problem only occurs when \end{frame} is used within the verbatim environment, despite the use of [fragile]. A different text does not cause the problem. The error produced by lualatex is the following:

Runaway argument?
! File ended while scanning use of \@xverbatim.

However, an older version (e.g. 3.36) of latex beamer from TeXLive 2016-20160801 does compile the MWE correctly without errors.

Further investigation showed that it looks like a regression from commit 0c387de (Fix for github issue #326).

  • This only used to work in an old version by accident because scanning for \end{frame} in a fragile slide was broken. – Henri Menke Aug 10 '17 at 23:41
4

beamer just scans ahead for \end{frame}, so you cannot use \end{frame} inside verbatim inside a frame. This is also documented:

enter image description here

But there is a workaround, which is also documented:

enter image description here

Applied to your specific example:

\documentclass{beamer}

\newenvironment{fragileframe}%
  {\begin{frame}[fragile,environment=fragileframe]}%
  {\end{frame}}

\begin{document}
\begin{fragileframe}
  \begin{verbatim}
    \end{frame}
  \end{verbatim}
\end{fragileframe}
\end{document}
  • Thanks for the clarification. The accidental support of older versions was a bit misleading and I didn't look into that direction to find a solution. – Herr Foerster Aug 10 '17 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.