【发布时间】:2018-07-05 08:39:41
【问题描述】:
我想减少我的 Rnw 文件 (LateX+R+Knitr) 中块之间的空间。我遇到了以下适用于文本输出的 Rnw 文件:https://gist.github.com/yihui/2760395#file-knitrout-parskip-rnw。如果您有图表,则没有 - 图表向上移动太远,代码和图表重叠。是否有可能重新定义 knitrout 以影响输出文本而不是图表?我不知道如何附加 pdf 输出,但下面是代码。
\documentclass{article}
% change the space between paragraphs in chunks
\ifdefined\knitrout
\renewenvironment{knitrout}{
\setlength{\parskip}{-1in}
}{
\setlength{\parskip}{0in}
}
\else
\fi
\begin{document}
The quick brown fox jumps over the lazy dog the quick brown fox jumps over the
lazy dog the quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog the quick brown fox jumps over the
lazy dog the quick brown fox jumps over the lazy dog.
<<test>>=
set.seed(77)
1+1
(x <- rnorm(30))
@
The quick brown fox jumps over the lazy dog the quick brown fox jumps over the
lazy dog the quick brown fox jumps over the lazy dog.
<<fig.height=3>>=
plot(x)
@
The quick brown fox jumps over the lazy dog the quick brown fox jumps over the
lazy dog the quick brown fox jumps over the lazy dog.
\end{document}
【问题讨论】: