I'm having trouble including Sweave output in my Beamer file. Specifically, the Soutput environment is causing problems (it runs if I comment those lines out, but, of course, the table is not presented as a single row and in standard font). Here is the basic file:


  Gender Admitted Rejected
1 Female        6        6
2   Male        6        6


And the error in its gory detail:

ERROR: FancyVerb Error:

--- TeX said ---
  Extraneous input `Gender Admitted Rejected 1 Female 6 6 2 Male 6 6 \end {Soutput} \end {Schunk} \end {beamer@frameslide}\ifbeamer@twoscreenstext \beamer@dosecondscreennow {{Comparison} \begin {Schunk} \begin {Soutput} Gender Admitted Rejected 1 Female 6 6 2 Male 6 6 \end {Soutput} \end {Schunk} }\fi \ifbeamer@anotherslide \advance \beamer@slideinframe by 1\relax \relax \expandafter \iterate \fi \let \iterate \relax \beamer@writeslidentry \beamer@reseteecodes ' between \begin{Soutput}[<key=value>] and line end
\FV@Error ... {FancyVerb Error:
\space \space #1

l.13 \end{frame}

--- HELP ---
From the .log file...

This input will be discarded. Hit <return> to continue.

Thanks for any assistance that you can provide.

  • 1
    I don't use sweave, so I can't test, but does starting the frame with \begin{frame}[fragile] help? – Caramdir Feb 21 '11 at 4:48
  • Yes, thank you! I'll have to find out more about the fragile option for the frame environment. – Charlie Feb 21 '11 at 5:33
  • Note that it is unusual around here to sign your questions (as there is already a box with your username below it) or to have any greeting. – Hendrik Vogt Feb 21 '11 at 7:09

From the beamer manual (section 12.9 Verbatim and Fragile Text in version 3.10):

If you wish to use a {verbatim} environment in a frame, you have to add the option [fragile] to the {frame} environment. In this case, you really have to use the {frame} environment (not the \frame command) and the \end{frame} must be alone on a single line.

So all you have to do is to replace \begin{frame} by \begin{frame}[fragile].

| 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.