Hello,

I'm learning to use Sweave, and I've run into a problem: sometimes, when
entering long lines of input and using long variable names, Sweave will not
insert linebreaks in a way that respects the width setting. This causes
undesirable overflows into the margins in the latex file. For example,
consider the following document (adapted from the GLM example):

\documentclass{article}
\begin{document}

<<setup,include=FALSE,echo=FALSE>>=
options(width=80)
@

<<test>>=
countsasdfasdfasdf <- c(18,17,15,20,10,20,25,13,12)
outcomeasdfasdfasdf <- gl(3,1,9)
treatmentasdfasdfasdfasdf <- gl(3,3)
glm.D93 <- glm(countsasdfasdfasdf ~ outcomeasdfasdfasdf +
treatmentasdfasdfasdfasdf, family=poisson())
@

\end{document}

When I compile this, treatmentasdfasdfasdfasdf sticks out into the right
margin. The linebreak is inserted after the last comma, so that the line as
printed is 85 characters long, even though I set width to 80 at the top.
Ideally, Sweave would set the linebreak after the last plus symbol.

There is a simple workaround that I have been using: if a line causes
problems, set width to something smaller before the line, and set it back
afterwards. It's pretty clumsy though, and I wonder if there is a better
way. My understanding is that there is no way to manually set linebreaks,
what a pity!

I am using R 2.6.2 and the MacTex 2007 distribution. If this problem has
been fixed in a recent version, I apologize.

Cheers,
Enrico

	[[alternative HTML version deleted]]

