4

我无法让 fig.env 在 knitr 中工作。这是一个简单的例子:

\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}

编织后,我在输出 .tex 文件中得到的只是图

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

}

关于可能出现问题的任何建议?

sessionInfo() R 版本 3.0.0 (2013-04-03) 平台:x86_64-w64-mingw32/x64 (64-bit)

4

1 回答 1

4

您需要fig.cap选择与figure环境相关的所有内容才能正常工作,例如

<<FIGURE, fig.cap='A boring figure.', fig.env='sidewaysfigure', fig.width=10, fig.height=5>>=
plot(1:10,1:10)
@
于 2013-06-18T21:18:08.150 回答