3
votes

I am using RStudio (0.98.501) to compile a .Rnw with R code chunks into a pdf. In the resulting PDF, there is no space between document text and R code chunks. I have not come across any knitr chunk or package options that let me specify vertical space between text and code chunks. I'd like to add one more line in between the text and the code chunk. I'm looking for a global solution; manually adding vertical space before each code chunk would not be reproducible.

Basic example showing partial .tex output from knitr compile:

Histogram of VCCT test dates:

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# sort}
  \hlstd{vcct.base} \hlkwb{<-} \hlstd{vcct.base[}\hlkwd{do.call}\hlstd{(order, vcct.base[}\hlkwd{c}\hlstd{(}\hlstr{"date.test.vcct"}\hlstd{)]), ]}
...
\end{alltt}
...
\end{knitrout}

enter image description here

1

1 Answers

1
votes

There must be several ways to do this. For example, you can define the knitrout environment:

\renewenvironment{knitrout}{\vspace{1em}}{}