According to FAQ.7 and Example.038, I should be able to control my width through global options options(width=40)
or chunk options tidy.opts(width.cutoff=40)
. However, the text still runs off the gray box, and in my current case where I have two-column beamer slides. the source code runs into the next column. Is there anything else I can do besides turning off tidy tidy=FALSE
and manually setting the breaks in my 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 is that columns run together):
Options should be passed like 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 you specify width.cutoff
for code and width
for r results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With