r - Control width of knitr output for columns in sweave documents -
according faq.7 , example.038, should able control width through global options options(width=40)
or chunk options tidy.opts(width.cutoff=40)
. however, text still runs off gray box, , in current case have two-column beamer slides. source code runs next column. there else can besides turning off tidy tidy=false
, manually setting breaks in code?
minimal working example:
\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}
output (problem columns run together):
options should passed this:
<<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) @
and here specify width.cutoff
code , width
r results.
Comments
Post a Comment