From murdoch.duncan at gmail.com  Fri Jan  3 01:45:41 2014
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Thu, 02 Jan 2014 19:45:41 -0500
Subject: [Rd] Sweave trims console output in "tex" mode
In-Reply-To: <52C5FEAF.5020708@ivt.baug.ethz.ch>
References: <52C5FEAF.5020708@ivt.baug.ethz.ch>
Message-ID: <52C60835.8060605@gmail.com>

On 14-01-02 7:05 PM, Kirill M?ller wrote:
> Hi
>
>
> In the example .Rnw file below, only the newline between c and d is
> visible in the resulting .tex file after running R CMD Sweave. What is
> the reason for this behavior? Newlines are important in LaTeX and should
> be preserved. In particular, this behavior leads to incorrect LaTeX code
> generated when using tikz(console=TRUE) inside a Sweave chunk, as shown
> in the tikzDevice vignette.
>
> A similar question has been left unanswered before:
> https://stat.ethz.ch/pipermail/r-help/2010-June/242019.html . I am well
> aware of knitr, I'm looking for a solution for Sweave.

You are running with the strip.white option set to TRUE.  That strips 
blank lines at then beginning and end of each output piece.  Just set 
strip.white=FALSE.

Duncan Murdoch

>
>
> Cheers
>
> Kirill
>
>
> \documentclass{article}
> \begin{document}
> <<inline,echo=FALSE,results=tex>>=
> cat("a\n")
> cat("b\n \n")
> cat("c\nd")
> @
> \end{document}
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Sweave trims console output in "tex" mode
Duncan Murdoch