Learn R Programming

r2lh (version 0.7)

r2lMainFile: ~ Generation of LaTeX main document ~

Description

This function generates a LaTeX main document designed to include some files built by r2lu or r2lb.

Usage

r2lMainFile(fileOut = "main.tex",text="\\input{univ.tex}",sweave=FALSE)

Arguments

fileOut
characters; name of the main document.
text
text to be included in the LaTeX document, between the '\begin{document}' and '\end{document}' macros.
sweave
logical; if TRUE, the main document is designed to be compiled with Sweave.

Value

A LaTeX or a Sweave file ("main.tex" by default).

Author

Christophe Genolini christophe.genolini@free.fr PSIGIAM: Paris Sud Innovation Group in Adolescent Mental Health INSERM U669 / Maison de Solenn / Paris Bernard Desgraupes bernard.desgraupes@u-paris10.fr University of Paris Ouest - Nanterre

English correction

Jean-Marc Chamot jchamot@u-paris10.fr Laboratoire "Sport & Culture" / "Sports & Culture" Laboratory University of Paris 10 / Nanterre

Details

r2lMainFile generates a LaTeX master file or a Sweave file ready to include some files built by r2lu or r2lb.

References

LaTeX web site http://www.latex-project.org/ Data are available on line: http://christophe.genolini.free.fr/EPO/EPO2007-Fraude.php

See Also

r2lu, r2lb, r2lh-package, examCheating, Sweave, latex

Examples

Run this code
 # # # # # # # # # # # # # # # # # # #
#   R to LaTeX, Main file generation  #
 #             Examples              #
  #           r2lMainFile           #
   # # # # # # # # # # # # # # # # #

### Creates a Sweave file
text <- "
\\maketitle
\\tableofcontents

<<>>=
data(examCheating)
@

\\section{Univariate analysis}

<<>>=
r2lu(examCheating$CheatScore,fileOut='ExamCheat-univ1.tex')
@
\\input{ExamCheat-univ1.tex}


\\section{Bivariate analysis}

<<>>=
#r2lb(examCheating$CheatScore~examCheating$Sexe,fileOut='ExamCheat-biv1.tex')
@
\\input{ExamCheat-biv1.tex}
"

if(!file.exists("tmp/sweave",recursive=TRUE)){dir.create("tmp/sweave",recursive=TRUE)}else{}
setwd("tmp/sweave")

r2lMainFile(fileOut="main.Rnw",text=text,sweave=TRUE)
Sweave("main.Rnw")
setwd("../..")

Run the code above in your browser using DataLab