Hi! 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, Katharina Hoff -- DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen! AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl
Try a code chunk like this: <<echo=FALSE>>options(width = 70) @ -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Katharina Hoff Sent: Friday, March 18, 2005 4:50 PM To: r-help at stat.math.ethz.ch Subject: [R] Sweave/margin Hi! 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, Katharina Hoff -- DSL Komplett von GMX +++ Superg?nstig und stressfrei einsteigen! AKTION "Kein Einrichtungspreis" nutzen: http://www.gmx.net/de/go/dsl ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
On Friday 18 March 2005 15:49, Katharina Hoff wrote:> Hi! > > 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?If I understand your problem correctly, you might want to try putting options(width = 40) at the top of your first chunk.> 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,It's in the Sweave FAQ: http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html -Deepayan
You can also use longish lines with smaller text by the following device: \usepackage{fancyvrb} %in the preamble (ie before \begin{document}) \fvset{fontsize=\small} %I think this can be changed during the document if you want, but I like it in the preamble too. Maybe the fancyvrb package has other ideas you can try. Hope this helps, Alun --------------------- Dr Alun Pope Group Credit St.George Bank Level 9 182 George St Sydney NSW 2000 (T): 02 9236 1442 (F): 02 9236 1570>>> Deepayan Sarkar <deepayan@stat.wisc.edu> 19/03/2005 9:01:41 am >>>On Friday 18 March 2005 15:49, Katharina Hoff wrote:> Hi! > > I am currently using Sweave for writing my bachelor thesis - and Ihave a> problem: > > I am using a LaTeX style (report) with quite big margin spaces. TheSweave> generated LaTeX code "floats" into the margin - and it looks ugly.The text> is blocked and fine... then there comes some flattering code runningover> the margin... and blocked text again. > > Considering the LaTeX output, I guess that Sweave puts the sourcecode> somehow in LaTeX-boxes and I suppose there is a place where I couldchange> the width of the source code boxes (At a certain point, there is abreak,> 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?If I understand your problem correctly, you might want to try putting options(width = 40) at the top of your first chunk.> Or probably I am totally wrong and someone knows another solution... > > Hoping for help - and excuse if anyone asked this stupid questionbefore, I> did not find it in the archive,It's in the Sweave FAQ: http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html -Deepayan ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ********************************************************************** ***** IMPORTANT INFORMATION ***** This document should be read only by those persons to whom it is addressed and its content is not intended for use by any other persons. If you have received this message in error, please notify us immediately. Please also destroy and delete the message from your computer. Any unauthorised form of reproduction of this message is strictly prohibited. St George Bank Limited AFSL 240997, Advance Asset Management Limited AFSL 240902, PACT Accountants Investment Group Pty Limited AFSL 240693, St George Life Limited AFSL 240900, ASGARD Capital Management Limited AFSL 240695 and Securitor Financial Group Limited AFSL 240687 is not liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. ********************************************************************** [[alternative HTML version deleted]]
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{fancyvrb} % \usepackage{Sweave} \DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl} \DefineVerbatimEnvironment{Soutput}{Verbatim}{} \DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl} \newenvironment{Schunk}{}{} 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: \newenvironment{Schunk}{\tiny}{} 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: jtk at cmp.uea.ac.uk | | *NEW* WWW: http://www.cmp.uea.ac.uk/people/jtk | *-----=< hierarchical systems are for files, not for humans >=-----*