是否knitr有一个选项,允许一个集R的width在每块基础的选择吗?
如果没有,是否有充分的理由(即根植于针织模型的一些基本限制),它不是吗?
为了展示我所希望的东西,这里有一个手动挂钩功能,基本上可以满足我的需求.(我真的不喜欢它,虽然,(一),因为它是丑陋的,依靠可变分配.width到全球的环境,和(b),因为它没有提供"开箱即用"作为提供选项像fig.width,out.width,等人)
\documentclass[preview=true,width=3mm]{standalone}
\begin{document}
<<setup, include=FALSE, cache=FALSE>>=
options(width=60)
knit_hooks$set(width = function(before, options, envir) {
if(before) {
    .width <<- options(width=options$width) ## Set width and save 'old' value
} else {
    options(.width)}                        ## Restore width's 'old' value
})
@
First chunk uses default width
<<A>>=
c("aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee", "fffff", "ggggg", "hhhhh")
@
Second chunk uses narrower supplied width, but then resets width to …我想在结果pdf中的一个框架框内打印一个R代码块(在Sweave中).
这样做有一个简单的解决方案吗?