R – How to change fonts in a beamer presentation that uses Sweave

beamerlatexrsweave

When I include \usepackage{Sweave} in the preamble of a beamer presentation, beamer ignores changes to font, e.g., \usepackage{helvet}.

Here is a minimal example:

\documentclass[professionalfonts]{beamer}

\usepackage[T1]{fontenc}
\usepackage{helvet}

\usepackage{Sweave}

\begin{document}

\begin{frame}
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
    sed do eiusmod tempor incididunt ut labore et dolore magna
    aliqua. Ut enim ad minim veniam, quis nostrud exercitation
    ullamco laboris nisi ut aliquip ex ea commodo consequat. 
\end{frame}

\end{document}

The text is set in computer modern, rather than helvetica. If you comment out \usepackage{Sweave}, then the text is set in helvetica.

Thus my question: Is there a way to change fonts in beamer presentations that include Sweave content?

I realize that my example here does not include any actual, "Sweable" R code, but it seems to not matter, because the unwanted font-switching behavior appears to result from Sweave.sty. My bigger goal is to use pgfSweave with beamer, but I'm having the same problem there. I think I have tracked it down to \usepackage{Sweave}.

Best Answer

From the R-help mailing list, Roger Peng suggests

\usepackage[noae]{Sweave}

See http://tolstoy.newcastle.edu.au/R/e2/help/06/11/4803.html

Also see http://www.theresearchkitchen.com/blog/archives/118

Related Topic