3

I'm failing to understand why this code compiles :

\documentclass{beamer}
\newenvironment{yyy}{\begin{frame} \begin{block}{youpi}  }{\end{block} \end{frame}}
\begin{document}
 { \begin{frame} \begin{block}{youpi}   bonjour \end{block} \end{frame} }
\end{document}

while that one does not :

\documentclass{beamer}
\newenvironment{yyy}{\begin{frame} \begin{block}{youpi}  }{\end{block} \end{frame}}
\begin{document}
  \begin{yyy}    bonjour \end{yyy}
\end{document}

... resulting in

File ended while scanning use of \beamer@collect@@body

If anyone has got an idea, i'd be greatful!

Johannes_B
  • 24,235
  • 10
  • 93
  • 248
skorqa
  • 95

1 Answers1

3

This is by-design and it depends on how frames are read by beamer. See this bug on the Beamer github repo, closed as wontfix.

You can however workaround the issue by including your code into a macro (not a new environment):

\documentclass{beamer}

\newcommand{\yyy}[1]{
    \begin{frame}
        \begin{block}{youpi}
        #1
        \end{block}
    \end{frame}
}
\begin{document}
  \yyy{bonjour}
\end{document}
d-cmst
  • 23,095