[R] Adding vertical space before and after Sweave chunk

Duncan Murdoch murdoch.duncan at gmail.com
Thu Jul 14 13:26:02 CEST 2011

On 11-07-14 3:23 AM, Mark Heckmann wrote:
> Thanks Duncan,
> the problem now is that, the space between R code and R output is also
> increased.
> I would like to avoid this, i.e.
> vertical space
> R code
> R results
> vertical space

Don't modify \topsep then, just put the spacing directly into the Schunk 
redefinition.  For example,


The way environments work in LaTeX is that the first arg (\vspace{20pt}) 
is put at the start, and the second one (\vspace{30pt}) at the end. 
Nothing happens in the middle, but the definitions for \Sinput and 
\Soutput implicitly make use of the \topsep size, so the definition 
below affected everything.

Duncan Murdoch

> TIA,
> Mark
> Am 14.07.2011 um 02:13 schrieb Duncan Murdoch:
>> On 13/07/2011 7:14 PM, Mark Heckmann wrote:
>>> I would like to have a bigger default space in front of and behind
>>> every Sweave chunk.
>>> I have seen that space between input and output is removed as follows:
>>> \fvset{listparameters={\setlength{\topsep}{0pt}}}
>>> \renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}}
>>> Still, I can't figure out how to add vertical space before and after
>>> the Sweave chunk.
>>> Can someone help?
>> "0pt" standard for "zero points". Use a bigger number if you want a
>> bigger space, e.g. 20pt.
>> Duncan Murdoch
> –––––––––––––––––––––––––––––––––––––––
> Mark Heckmann
> Blog: www. markheckmann .de <http://www.markheckmann.de/>
> R-Blog: http:// ryouready.wordpress .com <http://ryouready.wordpress.com/>

More information about the R-help mailing list