[Rd] Pkg creation: Sweave: multiple files vignette: Error in R CMD check

rolandh at uni-muenster.de rolandh at uni-muenster.de
Mon Nov 3 22:08:58 CET 2014

Hello R-developers!

I am creating a package (using devtools and RStudio) and I would like to split
my vignette into multiple Rnw-files.

As an example I tried the code from:
(--> Working with multiple Rnw files)

The Rnw-files work fine with "Complie pdf" in RStudio as well as with

But, if I try to check my package I get the following error:

* creating vignettes ... ERROR
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  :
  Ausführen von 'texi2dvi' für 'ChapterY.tex' fehlgeschlagen.
LaTeX errors:
! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
! Emergency stop.
<*> ...13 \let~\normaltilde  \input ./ChapterY.tex

*** (job aborted, no legal \end found)

!  ==> Fatal error occurred, no output PDF file produced!
Calls: <Anonymous> -> texi2pdf -> texi2dvi
Ausführung angehalten
Fehler: Command failed (1)
Ausführung angehalten

Exited with status 1.

So, it seems like that it is tried to make a tex-file from my child-Rnw-file
called "ChapterY.Rnw",
what of couse is not possible, because that file contains no praeambel.

As a workaround I tried to put my child-Rnw-file in a subfolder (ChapterY) and
calling this file by
Again, "Complie pdf" as well as Sweave("Master.Rnw") works fine, but with
checking the package
I get the following error:

Error in SweaveReadFile(c(ifile, file), syntax, encoding = encoding) :
  no Sweave file with name ‘./ChapterY/ChapterY.Rnw’ found
ERROR: installing vignettes failed

By the way I tried that on different (L)ubuntu machines (12.04, 14) which the
latest version of
RStudio and R, and I also tried it after updating texlive to version 2012,
always getting the same error.

Moreover, if I just use one Rnw-file instaed of multiple files checking the
package finished fine without errors!

I do not know what to do anymore, and I did not find any solution in the www

Do someone has any idea how to solve this problem in any way?

Thank you very very much in advance!



R version 3.1.2 (2014-10-31)
Platform: i686-pc-linux-gnu (32-bit)

 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C               LC_TIME=de_DE.UTF-8
 [9] LC_ADDRESS=C               LC_TELEPHONE=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] trajcoert01_0.1

loaded via a namespace (and not attached):
 [1] devtools_1.6       geosphere_1.3-8    grid_3.1.2         intervals_0.14.0
 [6] move_1.2.475       raster_2.2-31      rgdal_0.8-16       rgeos_0.3-4
[11] spacetime_1.1-2    tools_3.1.2        trajectories_0.1-1 xts_0.9-7

More information about the R-devel mailing list