I have a Rnw file that has a simple code chunk:
<<echo = TRUE, tidy = TRUE>>=
getNormIntegral = function(x, sd = 1) {
res = pnorm(x*sd, sd = sd) - pnorm(-1*x*sd, sd = sd)
return(1.0 - res)
}
@
This looks good here, but when I render it to a pdf file using knitr, the code collapses into a single line and runs past the box. I have tried to set the width option with the following:
<<echo=FALSE>>=
options(width=10)
@
but that did not have an affect. The resulting output in the pdf is:
(Ok, it is not extending past the box boundaries, but it is not honoring the manual line breaks that I put in the code...)
Any suggestions to make the output look like the code chunk that I typed in?
(I should add that I am using R 3.1.2, RStudio 0.99.34, and knitr 1.7)