4

I'm having trouble getting fig.env to work in knitr. Here's a simple example:

\documentclass[12pt]{article}
\usepackage{rotfloat}
\begin{document}


<<setup, include=F, cache=F>>=
opts_chunk$set(comment=NA,fig.path=file.path(getwd(),'figure/minimal-'),tidy=F, fig.align='center',size='footnotesize')
options(replace.assign=TRUE, width=60)
@

Hoping for a sideways figure!
<<FIGURE, fig.env='sidewaysfigure',fig.width=10, fig.height=5>>=
plot(1:10,1:10)
@

\end{document}

After knitting, all I get in the output .tex file for the figure is

{\centering \includegraphics[width=\maxwidth]{D:/R/figure/minimal-FIGURE} 

}

Any suggestions for what could be going wrong?

sessionInfo() R version 3.0.0 (2013-04-03) Platform: x86_64-w64-mingw32/x64 (64-bit)

mme
  • 128
  • 4

1 Answers1

4

You need the fig.cap option for everything related to the figure environment to work, e.g.

<<FIGURE, fig.cap='A boring figure.', fig.env='sidewaysfigure', fig.width=10, fig.height=5>>=
plot(1:10,1:10)
@
Yihui Xie
  • 28,913
  • 23
  • 193
  • 419