Thanks, Duncan,

I got it! I missread/-understood strip.white's meaning and thought it would refer only to blank lines within "real" code chunks (i.e., to those between \begin{Schunk} and \end{Schunk}), but not to the (TeX-)output which was generated by code chunks with results=tex.

My goal: I don't want blank lines at the beginning or end of "real" R output between \begin{Schunk} and \end{Schunk}), but want to be able to create linebreaks using cat( "\n") explicitly in chunks with results=tex

The solution appears to be: use strip.white=false "locally" in case of need, i.e., as the option for the respective code chunks (which also have results=tex, and from which I want "only" linebreaks in the TeX-output).

Actually, embarrassingly simple.

 Thanks again -- Gerrit


On Wed, 5 Mar 2014, Duncan Murdoch wrote:

On 05/03/2014 9:29 AM, Gerrit Eichner wrote:
Thanks, Duncan,

but, sorry, including

\SweaveOpts{strip.white=true}

doesn't help. Have tried that before and forgot to mention; sorry!

true is the default.  You want false.

Duncan Murdoch


BTW: using \SweaveOpts{strip.white="true"}, i.e., with quotation marks as
requested in RweaveLatex()'s help file, throws out

Error in match.arg(options$strip.white, c("true", "false", "all")) :
    'arg' should be one of "true", "false", "all"

which used to happen before (on my system) so that I used to use it w/o
quotes successfully. (!?)


Still big question marks ... Any further ideas?

   Regards -- Gerrit


On Wed, 5 Mar 2014, Duncan Murdoch wrote:

> On 05/03/2014 7:32 AM, Gerrit Eichner wrote:
>> Hello, everyone,
>>
>> I am struggling with an Sweave-problem that didn't occur sofar (and I have >> no clue what I might have changed in my system; see below). The following
>> example *.Rnw file's only task is (for simplicity) to output text with a
>> little bit of TeX-code with linebreaks (e. g., to be better readable):
>>
>>
>> \documentclass{article}
>> \begin{document}
>> Text 1 (not through cat()) followed by a double-backslash and
>> a blank line, i.e., a linebreak.\\
>>
>> <<echo=FALSE, results=tex>>=
>> cat( "Text 2 (through cat()) with a respected newline here\n",
>> "and likewise two tabs here\t\t followed by two double-backslashes
>> ",
>>        "and IGNORED newline escape characters at the end.\\\\ \n \n",
>>        sep = "")
>>
>> cat( "Text 3 (through cat()) just to finish this example and ",
>>        "with also IGNORED newline escapes at its end. \n \n", sep = "")
>> @
>> \end{document}
>>
>>
>>
>> When processed by Sweave I obtain the following TeX file:
>>
>>
>> \documentclass{article}
>> \usepackage{Sweave}
>> \begin{document}
>> Text 1 (not through cat()) followed by a double-backslash and
>> a blank line, i.e., a linebreak.\\
>>
>> Text 2 (through cat()) with a respected newline here
>> and likewise two tabs here              followed by two
>> double-backslashes and IGNORED newline escape characters at the end.\\
>> Text 3 (through cat()) to finish this example and with also IGNORED
>> newline escapes at its end. \end{document}
>>
>>
>> the point being that the linebreaks (\n) at the ends of the output
>> character strings have been completely ignored.
>
> See the "strip.white" option in ?RweaveLatex.
>
> Duncan Murdoch
>
>>
>> I wasn't successful in searching the archive, RSeek, SE and the like. Any
>> idea where and how to continue to search, or what to do to get back
>> Sweave's "old" behavior (except for reinstalling R ... which of course is
>> still an option)? Thanks for any hint!
>>
>>    Best regards  --  Gerrit
>>
>> PS:
>> > sessionInfo()
>> R version 3.0.2 (2013-09-25)
>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>>
>> locale:
>> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
>> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
>> [5] LC_TIME=German_Germany.1252
>>
>> attached base packages:
>> [1] graphics  grDevices utils     datasets  stats     methods   base
>>
>> other attached packages:
>> [1] fortunes_1.5-2
>>
>> loaded via a namespace (and not attached):
>> [1] grid_3.0.2      lattice_0.20-27 tools_3.0.2
>>
>>
>>
>> ---------------------------------------------------------------------
>> Dr. Gerrit Eichner                   Mathematical Institute, Room 212
>> gerrit.eich...@math.uni-giessen.de   Justus-Liebig-University Giessen
>> Tel: +49-(0)641-99-32104          Arndtstr. 2, 35392 Giessen, Germany
>> Fax: +49-(0)641-99-32109        http://www.uni-giessen.de/cms/eichner
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to