[R] Combining Sweave and fancyvrb
Michael Friendly
friendly at yorku.ca
Sat Mar 21 10:16:02 CET 2009
Andrew Ellis wrote:
> You cannot have \label in an S chunk, as R will not know what to do
> with it. Neither can you have \label in a verbatim environment, as it
> will simply be typeset verbatim.
>
Actually, with your definition of Sinput
\DefineVerbatimEnvironment{Sinput}{Verbatim} {
commentchar=@,
frame=lines, label=\textrm{\bf R code}, numbers=left,
framesep=10pt, fontshape=sl, commandchars=\\\{\}}
you can have \label{} in the verbatim environment. I haven't tried this
but something like
<<>>=
help() # \label{line1}
@
might work, and I believe there is a switch that suppresses the comments
for Sweave
-Michael
More information about the R-help
mailing list