yihui/knitr — Issue #121: knitr + beamer: an extra } in \end{kframe}} ?
Author: bryanhanson
Created: 2012-01-31 14:28:20+00:00
State: open

I'm using knitr with beamer. Here's a typical frame with code:

\begin{frame}[fragile]
\frametitle{Applications: Principal Components Analysis}
\begin{figure}
\begin{center}

<< pca, echo = F, fig = T, fig.width = 8, fig.height = 8, out.width = 0.5\textwidth, fig.align = center >>=
pcaRatPee <- classPCA(RatPee)
plotScores(RatPee, title = "NMR of Rat Urine", use.sym = TRUE, pcaRatPee, ellipse = "rob")
@
\end{center}
\end{figure}
\end{frame}

and here's the corresponding tex produced by knitr:

\begin{frame}[fragile]
\frametitle{Applications: Principal Components Analysis}
\begin{figure}
\begin{center}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{.97, .97, .97}{\color{fgcolor}\begin{kframe}

\centering{}\includegraphics[width=0.5\textwidth]{pca}

\end{kframe}}
\end{knitrout}

The \end{kframe}} seems to have an extra }. TeXShop complains about it, but I can just hit return for each complaint and the file does typeset properly. On the other hand, it's not really extra as it closes the {\color opening brace, but either way it doesn't seem to be parsed quite right.

Just thought I'd mention it. Don't see anything on the wiki about it. knitr 0.2 by the way. TeXShop 2.43, Mac OSX 10.7 Thanks.