knitr gives you full power to do whatever you want with the output, so you can use all sorts of LaTeX environments or packages to customize your output. For example, in this case, I think listings may be helpful; it has an option breaklines=true which allows you to break lines.
Here is a minimal example: https://gist.github.com/2209775 (output: http://i.imgur.com/3313T.png) The basic idea is to call render_listings() to set up output hooks using the listings package, and modify the error hook (http://yihui.name/knitr/hooks). For font size, yes the listings package is quite flexible as well. Again, you are free to customize the output with any LaTeX environments, not necessarily limited to listings. Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Mon, Mar 26, 2012 at 8:30 AM, John C Nash <nas...@uottawa.ca> wrote: > Yihui is correct that an error is generated. I should have mentioned that > this is > something I wanted to show in a vignette, and I got 103 characters as the > length of the > maximal line from a sink() file. Yihui's use of nchar is more elegant. > > Thus the question remains of how to avoid margin over-run in the vignette > output. I've > seen this several times now, and there are some postings on the web that look > like they > are from the same source, but apart from options(width = ...) not found a > solution. I can > edit the Sweave output .tex file, but that seems a bit drastic and contrary > to the spirit > of reproducible research tools. > > Possibilities: > - Can margins in Sweave (or knitr) be forced? > - Can the fixed width font size be adjusted easily? > > JN > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.