Problems with fig.env in knitr?

I'm having trouble getting fig.env to work in knitr. Here is 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 everything that I get in the output .tex file for the picture,

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

Any suggestions on what could go wrong?

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

+4
source share
1 answer

You need the fig.cap option for anything related to the figure environment, for example.

 <<FIGURE, fig.cap='A boring figure.', fig.env='sidewaysfigure', fig.width=10, fig.height=5>>= plot(1:10,1:10) @ 
+4
source

Source: https://habr.com/ru/post/1486923/


All Articles