The following minimal.Rnw input file
generates on output (using R --no-save <<<"library(knitr); knit('minimal.Rnw')" in a bash shell)
R --no-save <<<"library(knitr); knit('minimal.Rnw')"
% ... header stripped for brevity
That's two empty lines too much for my understanding. Sweave used to leave out these empty lines.
Is this a bug or a (hopefully configurable) feature?
There's a workaround that consists of defining a command that gobbles all following empty lines:
I do not know if this is a bug, and unfortunately this is not configurable. Why do you want to remove the two empty lines? Because it makes a and b separate paragraphs?
Exactly. If I want to back up a written sentence in a report with an R assertion, I want to keep both next to each other.
Fair enough. Can you move the chunk before a or after b? Since you do not want to output anything from the chunk, moving it might not hurt.
Yes, I could, but I prefer keeping code and text as close as possible to each other. For now, I use a TeX macro that gobbles all following empty lines to achieve what I want, see the link in one of my former comments.
The main reason that I do not want to change this is due to the concordance feature. It requires a little bit more careful thinking; I will think about it later.
I decided not to change this. Sorry.
No problem, I'm fine with the workaround. You might want to list this behavior (and a hint how to work around it) in your documentation somewhere. Please feel free to use the code in the TeX.SX answer.
put #231 in doc