% use 'handout' to produce handouts %\documentclass[handout]{beamer} \documentclass{beamer} \usepackage{wasysym,graphicx,pgfpages,Sweave} \newcommand{\vn}[1]{\mbox{{\it #1}}} \newcommand{\vb}{\vspace{\baselineskip}} \newcommand{\vh}{\vspace{.5\baselineskip}} \newcommand{\vf}{\vspace{\fill}} % I define 'mypause to be either \pause or null so I can decide % later if I want to use overlays \newcommand{\mypause}{} %\newcommand{\mypause}{\pause} % uncomment the next line for handouts %\pgfpagesuselayout{4 on 1}[letterpaper, border shrink=5mm,landscape] % Boadilla has page numbers, but no navigation bar % Frankfurt has no page numbers but does have a navigation bar \usetheme{Boadilla} %\usetheme{Frankfurt} %\usepackage{beamerthemesplit} % I like to use Maroon and Gold rather than White and Blue, and % sienna for some highlighting. I define the colors myself \definecolor{maroon}{rgb}{.6902,.1882,.3765} \definecolor{sienna}{rgb}{.53,.31,.16} \definecolor{gold}{rgb}{1,.84314,.0000} \setbeamercolor{frametitle}{fg=maroon,bg=gold} \usecolortheme[named=maroon]{structure} \title{Sweave and Beamer} \author[S. Weisberg]{Sanford Weisberg} \institute{Univ. of Minnesota} \date{February 1, 2008} \begin{document} % If you don't like section header slides, comment out the following %\AtBeginSection[]{% %\begin{frame} %\frametitle{Outline} %\tableofcontents[currentsection] %\end{frame} %} % End for section header slides \frame{\titlepage} % Comment out if you don't want a table on contents slide %\frame{\tableofcontents} \section{Text only} \begin{frame}[containsverbatim] \frametitle{Text} Here is an example with just output. To show input and output, set echo to TRUE. <>= options(width=55,show.signif.starts=FALSE) library(alr3) data(forbes) m1 <- lm(Lpres~Temp,forbes) summary(m1)$coef @ \end{frame} \begin{frame} \frametitle{Using xtable} The \texttt{xtable} package outputs data in \LaTeX\ format: <>= library(xtable) xtable(summary(m1)$coef) @ \end{frame} \begin{frame}[containsverbatim] \frametitle{Draw a graph automatically} A file called \texttt{mystuff1-one.pdf} will be created, where \texttt{mystuff1.Rnw} is the name of the file. <>= plot(Lpres~Temp,forbes) abline(m1) @ \end{frame} \begin{frame} \frametitle{Create a graph, but you size it} <>= plot(Lpres~Temp,forbes) abline(m1) @ \vspace{-.5in} \includegraphics[width=\textwidth]{mystuff1-two.pdf} \end{frame} \end{document}