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

Gorjanc Gregor Gregor.Gorjanc at bfro.uni-lj.si
Sun Feb 27 00:33:36 CET 2005


Imagine this situation:

% --- a.Rnw start ---
\documentclass{book}
\usepackage{Sweave}
\begin{document}
% some toy example
<<print=TRUE>>=
x <- 1:10
@
% now we input additional file
\input{a1}
% and lets look again at x
<<print=TRUE>>=
x
@
\end{document}
% --- a.Rnw end ---

% --- a1.Rnw start ---
%\usepackage{Sweave}
% add 1 to x
<<print=TRUE>>=
x <- x + 1
@
% --- 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
------------------------------------------------------------------------



-----Original Message-----
From: Mohamed Abdolell [mailto:m.abdolell at utoronto.ca]
Sent: sob 2005-02-26 21:48
To: Gorjanc Gregor; r-help at stat.math.ethz.ch
Subject: RE: [R] Sweave and \input or \include LaTeX commands
 
I have used \input in my .Snw file and it works fine.

- Mohamed


-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gorjanc Gregor
Sent: February 23, 2005 10:50 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Sweave and \input or \include LaTeX commands

Hello!

I was just wondering if Sweave can work with \input or \include 
LaTeX commands. So, is it aware of such a possible hierarchy in
documents. I would test that, but I don't have such a report 
available at the moment.

I thought of that when I was writting shell script for Sweave
from command line and I have solved that part there.

--
Lep pozdrav / With regards,
    Gregor GORJANC

---------------------------------------------------------------
University of Ljubljana
Biotechnical Faculty       URI: http://www.bfro.uni-lj.si
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

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list