本文介绍了在已编译的 pdf 中的文档文本和 knitr 代码块之间添加空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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:
egin{knitrout}
definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}color{fgcolor}egin{kframe}
egin{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:
enewenvironment{knitrout}{vspace{1em}}{}
这篇关于在已编译的 pdf 中的文档文本和 knitr 代码块之间添加空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!