Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sweave from the command line using concordance=TRUE

I have document that uses a LaTeX Beamer template and passes this code around the beginning of the actual document

\usepackage{Sweave}
\begin{document}
\SweaveOpts{concordance=TRUE}

The document compiles just fine using RStudio (0.97.248) with R-2.15.2. After I finish composition, to insure reproducibility, I like to generate the entire analysis from a cmd file (and use ghostscript to compress the PDF). The relevant parts are

R CMD Sweave MyDoc
pdflatex MyDoc
bibtex MyDoc
pdflatex MyDoc
pdflatex MyDoc

This fails with the error message

 ! LaTeX Error: File `MyDoc-concordance.tex' not found.

Which suggests that Sweave is not generating the concordance from the command line. A can't find a command line switch and my Google searches have not been helpful... I would greatly appreciate any pointers...

like image 509
jrminter Avatar asked Jan 09 '13 16:01

jrminter


1 Answers

Typically you wil run into this problem when parsing .Rnw files on the command line that were first created in RStudio. The RStudio Sweave template has the \SweaveOpts{concordance=TRUE} option as a default in the .Rnw file.

This seems to be an issue with Sweave that has not had much attention. Occasionally I run into this when working on the command line and the only work-around I have found is to set:

\SweaveOpts{concordance=FALSE} 

in the file itself, delete all temporary latex and then run R CMD Sweave again to create a new .tex file. The resulting file will work with either pdflatex or xelatex.

Apparently it is not possible to pass the request for a concordance file to Sweave (I tried R CMD Sweave MyDoc.Rnw --options=concordance=TRUE as I mentioned in the comments).

like image 76
FvD Avatar answered Nov 13 '22 10:11

FvD