[Rd] Output multiline verbatim in Rd files with \Sexpr in PDF manual

Renaud Gaujoux renaud at mancala.cbio.uct.ac.za
Fri Oct 28 16:36:21 CEST 2011


Hi,

I want to output some generated text in verbatim in a Rd file, but do 
not succeed in getting it render well in all versions (text, html and pdf).
I tried something like:

\Sexpr[results=verbatim, stage=render]{cat("line\nnext line")}

I use Rdconv to render each version of the man page.
This produced the expected effect in html, but resulted in a single line 
"line next line" in the pdf and text versions.
Moreover, if I add an empty line as in:

\Sexpr[results=verbatim, stage=render]{cat("line\nnext line\n\nyet 
another line")}

then the html is still correctly rendered, the text version correctly 
shows the empty newline (but still not the firts line break), and the 
pdf cannot be generated from the Latex code (because \AsIs breaks on the 
newline).

I tried several combination of options (results=text, rd) and rd 
commands (\cr, \preformated) but these are always somehow escaped when 
generating the Latex file.
Is there a way to go around these issues? Maybe I am not using the 
correct way.

Thank you.

Renaud

-- 
Renaud Gaujoux
Computational Biology - University of Cape Town
South Africa



More information about the R-devel mailing list