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
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
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
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
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 ---