[英]add space between document text and knitr code chunk in compiled pdf
I am using RStudio (0.98.501) to compile a .Rnw
with R code chunks into a pdf. 我正在使用RStudio(0.98.501)将带有R代码块的
.Rnw
编译为pdf。 In the resulting PDF, there is no space between document text and R code chunks. 在生成的PDF中,文档文本和R代码块之间没有空格。 I have not come across any
knitr
chunk or package options that let me specify vertical space between text and code chunks. 我还没有遇到任何
knitr
块或软件包选项,这些选项可以让我指定文本块和代码块之间的垂直空间。 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: 基本示例显示了knitr编译的部分
.tex
输出:
Histogram of VCCT test dates: VCCT测试日期的直方图:
\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}
There must be several ways to do this. 必须有几种方法可以做到这一点。 For example, you can define the
knitrout
environment: 例如,您可以定义
knitrout
环境:
\renewenvironment{knitrout}{\vspace{1em}}{}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.