Re: [R] Sweave/margin

From: Jan T. Kim <>
Date: Tue 22 Mar 2005 - 00:51:52 EST

On Fri, Mar 18, 2005 at 10:49:32PM +0100, Katharina Hoff wrote:

> I am currently using Sweave for writing my bachelor thesis - and I have a
> problem:
> I am using a LaTeX style (report) with quite big margin spaces. The Sweave
> generated LaTeX code "floats" into the margin - and it looks ugly. The text
> is blocked and fine... then there comes some flattering code running over
> the margin... and blocked text again.
> Considering the LaTeX output, I guess that Sweave puts the source code
> somehow in LaTeX-boxes and I suppose there is a place where I could change
> the width of the source code boxes (At a certain point, there is a break,
> closely before the text would drift out of the page. Then the code continues
> in new lines below.)
> Does anyone know where I could change or insert the box width?
> Or probably I am totally wrong and someone knows another solution...
> Hoping for help - and excuse if anyone asked this stupid question before, I
> did not find it in the archive,

I assume you talk about R code lines extending into the right margin of pages. These are due to the formatting of such stuff using Verbatim environments.

To gain control over code formatting, you can copy the pertinent lines from Sweave.sty into your document's preamble:


    % \usepackage{Sweave}



The comment "% \usepackage{Sweave}" is needed, it suppresses the insertion of that usepackage line by Sweave.

My Sweave manual just mentions that you are to define Sinput and Soutput, but in fact, both are wrapped by the currently (R 2.0.1) unused Schunk environment, providing you with a convenient handle for altering the font size, as e.g. in:


Alternatively, you can make use of the fontsize parameter provided by the Verbatim package of LaTeX.

Finally, you can always try to tweak your R code to consist of, and to produce shorter lines.

Best regards, Jan

 +- Jan T. Kim -------------------------------------------------------+
 |    *NEW*    email:                               |
 |    *NEW*    WWW:             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Tue Mar 22 00:01:06 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:51 EST