I'm ashamed to say, that continued searching has found that I had already been given the answer to this earlier this year. But in a different context and my initial searches didn't find it.

The answer is to put the Sweave code into an ERT box and start it with:

/SweaveOpts{keep.source=TRUE}

This stops the R parser from ignoring the line break codes.

In the article class document that I copied the text from, I had added this to the preamble and hadn't realised it was there.

In fact I now also realise that you can use it as a scrap using
<<echo=TRUE, keep.source=TRUE>>=

Graham

Graham

Graham M Smith wrote:
I have an Sweave/lyx document with a long line of code .

As an article (noweb), ctrl+return allows me to break up the code and allow it to fit the page and still work as code.

I have pasted the text from the article class file into a new file that uses the book class (noweb). But now the line runs off the edge of the page and the single ctrl+return I can see, prints out as \n rather than wrapping the text.

As always, I could do with some suggestions as to how to fix this.

Graham




--
--
Graham M Smith
graham.sm...@myotis.co.uk

Station Cottage, Station Road
Binegar, Somerset
BA3 4UQ


Reply via email to