Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
控制SWAVE文档中列的knitr输出宽度_R_Knitr_Sweave - Fatal编程技术网

控制SWAVE文档中列的knitr输出宽度

控制SWAVE文档中列的knitr输出宽度,r,knitr,sweave,R,Knitr,Sweave,根据和,我应该能够通过全局选项options(width=40)或块选项tidy.opts(width.cutoff=40)来控制宽度。但是,文本仍然在灰色框中显示,在我当前的例子中,我有两个列beamer幻灯片。源代码将运行到下一列。除了关闭tidytidy=FALSE并手动设置代码中的中断之外,我还能做什么 最简单的工作示例: \documentclass[8pt]{beamer} \begin{document} \begin{frame}[fragile] <<>>

根据和,我应该能够通过全局选项
options(width=40)
或块选项
tidy.opts(width.cutoff=40)
来控制宽度。但是,文本仍然在灰色框中显示,在我当前的例子中,我有两个列beamer幻灯片。源代码将运行到下一列。除了关闭tidy
tidy=FALSE
并手动设置代码中的中断之外,我还能做什么

最简单的工作示例:

\documentclass[8pt]{beamer}
\begin{document}
\begin{frame}[fragile]
<<>>=
library(reshape2)
options(width=38)
@ 
\begin{columns}[t]
  \column{.5\textwidth}
  <<>>=
  dataframe <- data.frame(Column1=1:10,Column2=1:10,Variable=1:10,Value=1:10)
  @ 
  \column{.5\textwidth}
  <<>>=
  dataframe <- melt(dataframe,
  id.vars=c("Column1","Column2"),
  variable.name="Variable",
  value.name="Value")
  @ 
\end{columns}
\end{frame}
\end{document}
\documentclass[8pt]{beamer}
\开始{document}
\开始{frame}[易碎]
=
图书馆(E2)
选项(宽度=38)
@ 
\开始{columns}[t]
\列{.5\textwidth}
=

dataframe选项应按如下方式传递:

<<echo=FALSE>>=
opts_chunk$set(comment="", message=FALSE,tidy.opts=list(keep.blank.line=TRUE, width.cutoff=120),options(width=100), cache=TRUE,fig.align='center',fig.height=6, fig.width=10,fig.path='figure/beamer-',fig.show='hold',size='footnotesize', cache=TRUE)
@
=
opts_chunk$set(comment=”“,message=FALSE,tidy.opts=list(keep.blank.line=TRUE,width.cutoff=120),options(width=100),cache=TRUE,fig.align='center',fig.height=6,fig.width=10,fig.path='figure/beamer-',fig.show='hold',size='footnotesize cache=TRUE)
@

这里您为代码指定
width.cutoff
,为r结果指定
width

请提供一个最小的可重复示例。您尝试过基本块选项吗?尤其是
out.width
out.width
用于数字。除了
width.cutoff
,还有什么文本输出吗?您可以设置
tidy=FALSE
来清理格式。但正如例子中所说的,您的输出太宽了——您要计算总线宽并将其分成两列,两列的宽度相等,但您还必须考虑到两列之间浪费的空白……我在最初的问题中已经提出了
tidy=FALSE
。但是说真的,尽管上面图像中的文本溢出似乎比由于列之间或沿边距浪费的空间造成的溢出要严重得多。您也可以在上检查可能的块选项,但我花了一段时间收集了我一直想要的所有选项:)