Text Formattingbeamer | Fragile Frames as new Commands

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
turok
Posts: 7
Joined: Wed Oct 17, 2012 2:26 pm

beamer | Fragile Frames as new Commands

Post by turok »

I have a problem with following code:

Code: Select all

\documentclass{beamer}
\newcommand{\frameFragile}{\frame[fragile]} 
\begin{document}
\frame[fargile]{A}% works
\frameFragile{A}% don't works
\end{document}

Code: Select all

! File ended while scanning use of \next.
or

Code: Select all

\documentclass{beamer}
\newenvironment{wykFrameFragile}{\begin{frame}[fragile]}{\end{frame}}
\begin{document}
\begin{frame}[fragile] % works
A
\end{frame}
\begin{wykFrameFragile} % don't works
A
\end{wykFrameFragile}
\end{document}

Code: Select all

! File ended while scanning use of \next.
Do you know any way to define environment or command or something similar with frame [fragile]?
Thanks
Last edited by localghost on Wed Oct 17, 2012 5:59 pm, edited 3 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

beamer | Fragile Frames as new Commands

Post by josephwright »

Beamer's scanning system does not work in the 'normal' way, and does not expand material in the usual way. As such, you cannot wrap \begin{frame} or \end{frame} inside other macros.
Joseph Wright
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

beamer | Fragile Frames as new Commands

Post by CrazyHorse »

turok wrote:I have a problem with following code:

Code: Select all

\documentclass{beamer}
\newcommand{\frameFragile}{\frame[fragile]} 
\begin{document}
\frame[fargile]{A}% works
\frameFragile{A}% don't works
\end{document}
you have to use the environment option. It tells beamer to look for your name and not"frame":

Code: Select all

\documentclass{beamer}
\newenvironment{wykFrameFragile}[1]
  {\begin{frame}[fragile,environment=wykFrameFragile]
      \frametitle{#1}}
  {\end{frame}}

\begin{document}
\begin{frame}[fragile] % works
A
\end{frame}
\begin{wykFrameFragile}{Frame Title} % works
A
\end{wykFrameFragile}

\end{document}
Post Reply