[R] Sweave and \input or \include LaTeX commands

Gorjanc Gregor Gregor.Gorjanc at bfro.uni-lj.si
Sun Feb 27 12:24:31 CET 2005


Gabor,

can you say this in some other way. I appologize, but I just don't 
understand anything. I really don't see any connection with R CMD CHECK
and vignettes.

I would just like to see that Sweave would follow \input of \include
commands of LaTeX. You can try with the following example bellow. I
don't know how Sweave is parsing Rnw files, but my idea was that if 
Sweave finds \input or \include in a "top" file (a.Rnw) it would also
parse "included" file (a1.Rnw) and then contninue with the top file
(a.Rnw). As I said just an idea. All this would be done at Sweave
level and one should run LaTeX only after Sweave handles all the files.

Thanks, Gregor

-----------------------------------------------------------------------
If this were supported it should have a different command than the
latex one or else one would not be able to do it at the latex level.
One might want to do it at the latex level rather than the Sweave
level in the case that one wants to have a vignette pass R CMD CHECK
but the vignette depends on software that is not generally available
or perhaps the vignette involves a large computation which would
otherwise impact every run of R CMD CHECK.  In these cases the portion
of the vignette that depends on the unavailable software or large
computation could be preprocessed using Sweave and then included
at the latex level to get by R CMD CHECK.

Gorjanc Gregor <Gregor.Gorjanc <at> bfro.uni-lj.si> writes:

:
: Imagine this situation:
:
: % --- a.Rnw start ---
: \documentclass{book}
: \usepackage{Sweave}
: \begin{document}
: % some toy example
: <<print=TRUE>>=
: x <- 1:10
:  <at>
: % now we input additional file
: \input{a1}
: % and lets look again at x
: <<print=TRUE>>=
: x
:  <at>
: \end{document}
: % --- a.Rnw end ---
:
: % --- a1.Rnw start ---
: %\usepackage{Sweave}
: % add 1 to x
: <<print=TRUE>>=
: x <- x + 1
:  <at>
: % --- a1.Rnw end ---
:
: > Sweave("a.Rnw")
: Writing to file a.tex
: Processing code chunks ...
:  1 : echo print term verbatim
:  2 : echo print term verbatim
:
: You can now run LaTeX on a.tex
:
: When you run Sweave on a.Rnw it founds only two chunks of R code. So it
: does not go into a1.Rnw i.e. it does not follow \input command. This
: would be very usefull if one has such hierarchies in documents. Afcourse
: one can use Sweave on a.Rnw and a1.Rnw and then run LaTeX, but it would be
: nice if just one Sweave would do Sweave job for all files i.e. the same
: as LaTeX does.

--
Lep pozdrav / With regards,
    Gregor GORJANC

------------------------------------------------------------------------
University of Ljubljana
Biotechnical Faculty       URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department    email: gregor.gorjanc <at> bfro.uni-lj.si
Groblje 3                  tel: +386 (0)1 72 17 861
SI-1230 Domzale            fax: +386 (0)1 72 17 888
Slovenia




More information about the R-help mailing list