22

Is there a way to specify fragile mode as default for all frames? Now I know how to define a fragile frame: \begin{frame}[fragile].

1 Answer 1

23

You could define your own frame environment like it is explained in the user manual p.62, e.g.:

\newenvironment{xframe}[2][]
  {\begin{frame}[fragile,environment=xframe,#1]
  \frametitle{#2}}
  {\end{frame}}

The environment option does the trick. It tells beamer that the frame ends with an \end{xframe} now.

Note that the frame has a complex set of optional arguments, including two < > and to optional(!) braced arguments for the frame title and sub-title. Not all of these arguments might be supported by the above code. You might write it better as:

\newenvironment{xframe}[1][]
  {\begin{frame}[fragile,environment=xframe,#1]}
  {\end{frame}}

which should support both optional title and sub-title arguments. You also can define the frame title using an explicit \frametitle command.

Another, more complex alternative is to use the xparse package to define xframe with the same arguments of frame and pass it along.

2
  • Is there a way to set fragile as default for frame, instead of creating xframe?
    – han-tyumi
    Commented Dec 3, 2015 at 19:27
  • @Majoko: I'm not aware of one. Commented Dec 5, 2015 at 9:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .