[Rd] R CMD check and error in an \Sexpr in an Rd file
Renaud Gaujoux
renaud at mancala.cbio.uct.ac.za
Thu Nov 3 12:58:44 CET 2011
Georgi, I tried with paste() instead of cat(), but I then get the
following in my PDF manual:
[1] "line\nnext line"
i.e. what would be printed in the R console, which is not what I want.
I would like to get something like this in the Latex code:
\begin{verbatim}
line
next line
\end{verbatim}
Using cat() I get the following in the Latex code:
\AsIs{
line
next line}
which does not render as a new line in the PDF and breaks if empty lines
are present in the output text.
Besides it will also break on \Sexpr[results=verbatim,
stage=render]{list("text", 3)}.
But maybe this is not what 'results=verbatim' is supposed to do nor to
be used for?
Renaud
Another test Rd file.
%%%%%%%%%
\name{Sexpr}
\alias{Sexpr}
\title{Error and verbatim in Sexpr}
\description{
Testing Sexpr in Rd files
%\Sexpr[results=verbatim, stage=render]{stop("error in sexpr")}
Verbatim:
1: \Sexpr[results=verbatim, stage=render]{cat("line\nnext line\n")}
2: \Sexpr[results=verbatim, stage=render]{"line\nnext line\n"}
3: \Sexpr[results=verbatim, stage=render]{list("line\nnext line", 3)}
Text:
1: \Sexpr[results=text, stage=render]{cat("line\nnext line\n")}
2: \Sexpr[results=text, stage=render]{"line\nnext line\n"}
3: \Sexpr[results=text, stage=render]{list("line\nnext line", 3)}
}
%%%%%
More information about the R-devel
mailing list