In knitr, how to set figure width with \textwidth from Latex

Viewed 4087

I have tried the following to set figure width with knitr and LaTeX:

\documentclass{paper}
\begin{document}
<<fig.width=\textwidth>>
x = runif(1000)
plot(x)
@
\end{document}

However, I get the following error:

<to be read again> 
                >
l.54 <<fig.width=\textwidth>
                        >

What am I doing wrong?

2 Answers
Related