[R] Sweave and \input or \include LaTeX commands
Gregor GORJANC
gregor.gorjanc at bfro.uni-lj.si
Tue Mar 1 07:53:47 CET 2005
Hi!
What is wrong if there would be the same command? Recall my example from
previous posts and at the end of this mail. If I have a file a.Rnw and this
one inputs file a1.Rnw. My idea was that Sweave would check \input{a1} or
\include{a1} statements. If file a1 would have extension .Rnw it would
parse it otherwise (i.e. having .tex) it would skip it. Sweave would just
parse .Rnw files, while latex would put all of them in one file during
typesetting.
Example:
- we have files
a.Rnw, which has \input{a1} or \include{a1}
a1.Rnw
- run Sweave(a.Rnw) and you get
a.tex
a1.tex
- run LaTeX (i.e. texi2dvi --pdf a.tex) and you get
a.pdf
Having new command i.e. \SweaveInput{} would also do the job perfectly,
however I don't se any new benefits of it. One should write more or less
the same R code as for \input or \include.
-----------------------------------------------------------------------
[...]
> Gabor
> Since this might not be desirable in all instances,
> if Sweave were to have an include facility then it should
> not be implemented in such a way that the latex include facility
> can no longer be used. The point was just that it should be possible
> to do the include at the Sweave or at the latex level.
Friedrich
I agree that it should not be the same command. I have put an
\SweaveInput{} on my 2do list, should be doable for R 2.1.0.
--
Lep pozdrav / With regards,
Gregor GORJANC
-----------------------------------------------------------------------
University of Ljubljana
Biotechnical Faculty URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department mail: 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, Europe
-----------------------------------------------------------------------
: 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 ---
More information about the R-help
mailing list