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!

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}
| improve this answer | |

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.