Skip to content

Instantly share code, notes, and snippets.

@yihui
Created May 21, 2012 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yihui/2760395 to your computer and use it in GitHub Desktop.
Save yihui/2760395 to your computer and use it in GitHub Desktop.
customize the knitrout environment
\documentclass{article}
% change the space between paragraphs in chunks
\parindent = 0.0in
\parskip = 0.125in
\ifdefined\knitrout
\renewenvironment{knitrout}{
\setlength{\parskip}{0in}
}{
\setlength{\parskip}{0.125in}
}
\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>>=
1+1
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.
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}
\documentclass{article}
% decrease the space before and after the chunk output environment
% (use negative vertical space)
\ifdefined\knitrout
\renewenvironment{knitrout}{
\vspace{-1em}
}{
\vspace{-1em}
}
\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>>=
1+1
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.
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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment