See ?system.file with the package= argument. On Fri, Oct 10, 2008 at 2:19 PM, Peter Ruckdeschel <[EMAIL PROTECTED]> wrote: > Hi, > > this may be slightly off-topic, but as you are the experts: > > we have written a small vignette, in which we want to refer to > .R, .Rd source files by means of relative paths. > > More specifically, we want to use TeX package "listings" to include > source code, > > [which btw in the mean time works pretty well together with "fancyvrb" > so can be used > with Sweave without problems...] > > To avoid redundancy we would like to use > > \lstinputlisting[firstline=<n1>,lastline=<n2>]{<r-source-file.R>} > > and to do so we somehow need path information. > > This is /not/ a "listings" issue, as we might also have used > \input{<r-source-file.R>}, only is \lstinputlisting a bit more > flexible... > > Using relative paths, i.e. as the vignette resides in subfolder "inst/doc" > something like > > ../../../<mypkg>/R/<myR.R> or ../../../<mypkg>/man/<myRd.Rd> > > does the job for both R CMD build and R CMD check , > --- in standard configurations. > > However, as you may change the location of the check folder with > the -o option of R CMD check, (and possibly other things, we have > not yet thought of ...), our solution is not quite satisfactory, > so we have been wondering whether there is a (platform-independent) > way to access the package source folder (under check) from within > TeX. > > --- or if you prefer to solve it from R-side: > > We would appreciate an Sweave-chunk to do the following: > +have three arguments firstline, lastline, filename > [where filename is relative to the package source folder] > +read out the information about the path to the package > source folder [from the env-variable?] > +with this information read in the part of the source file > between <firstline> and <lastline> > and places this content ---without wrapping it to > \begin{Schunk} ... \end{Schunk}--- into the .tex file > ---preferrably already into a \begin{listing}\end{listing} > environment... > > Any suggestions how to resolve this? > > Thank you already, > Peter > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel