1
votes

I have a file for my thesis, which include the chapters. A few weeks ago, I worked with R-Statistic and *.rnw files to produce a *.tex paper. Now, I want to include these *.tex paper in my thesis. However, every time I get several errors.

  1. Structure

    /home/UserName/R-files/Dokumentation5.rnw 
    
    /home/UserName/tex-Files/Dokumentation5.tex  // from Dokumentation5.rnw files
    
  2. In the following folder, I put the TeX and the figures (*.pdf).

    /home/UserName/Documentation/chapter/
    
  3. Edit the Dokumentation5.tex, remove the beginning and "end document"

  4. In thesis file, I added the following commands:

    \usepackage{Sweave}    \include /home/UserName/Documentation/chapter/
    
  5. run latex

If I run LaTeX, I got several errors like:

File `Dokumentation5-004' not found.

 \begin{document} ended by \end{Schunk}.

 Too many }'s

 File `Dokumentation5-033' not found.
1
How about you make the whole thesis in sweave (knitr?)? I would make a master .Rnw file and use \include to add different chapters.Roman Luštrik
What is the easiest way?rXhalogene
If I may recommend my older post...vaettchen

1 Answers

2
votes
  1. Create a file master.Rnw that contains nothing but the LaTeX setup (packages to be used, geometry, title, begin/end document, bibliography style and file......)
  2. If you need to use R functions in various places in your paper, create a file func.Rnw where you create these functions. Make this file the first to \SweaveInput{func.Rnw} in your master.Rnw - see here for details
  3. Now create one file for each "unit" of your paper (chapter, section, whatever you like). Make them all chapX.Rnw files, whether they contain R code or not.
  4. \SweaveInput{chapX.Rnw} them in the desired order in your master.Rnw file.
  5. At any time during the process, run Sweave("master.Rnw") in R and then pdflatex master.tex from the console to see what you have produced.