[R] LaTeX/R/Sweave Problems

tudor tudor_bodea at hotmail.com
Sun Feb 21 04:25:30 CET 2010


Dear all:

Thank you so much for all your feedback.  Since based on your suggestions I
was able to create a working R/Sweave/LaTex environment I summarize below
the steps I followed to accomplish this task.  I hope this approach
could/may help others with similar problems.

1. Install R, Adobe Acrobat Reader and in this order MiKTeX, Ghostscript, 
GhostGum with Ghost View and TeXnicCenter.  When asked how to install the
new packages (MiKTeX or TeXnicCenter) select Install Packages on the Fly. 
It appears that there is a known problem with MiKTeX2.8  and the latest
version of TeXnicCEnter and the above takes care of it.

2. Follow the suggestions below to add Sweave.sty to MiKTeX database (Thank
you Dennis and Dieter).  Follow the link from Dennis’ message to accomplish
this task.  Make sure that you have the right folder structure in
LocalTexFiles (i.e., C:\LocalTeXFiles\tex\latex\misc\Sweave.sty).

Dennis
MikTeX is rather picky about packages and inserting files into its database.
You can do something like the following (it's been a few months and my
exact memory of the sequence is hazy):

  * create a directory in your user top-level directory called LocalTeXFiles
  * copy the Sweave files (.sty, .cls) to this directory
  * open MikTeX's package manager
  * have MikTeX add the package to its database (I seem to remember that
    the directory had to be specified as local, but...?)
  * update MikTeX

Follow this guide:
http://docs.miktex.org/manual/localadditions.html

The problem is with MikTeX rather than the other software bundles you
installed,
and it's not an 'obvious' error.

Dieter
Assuming that you are working on Windows, I suggest that you either put
Sweave into you local texmf directory, or add the <RHOME>/share/texmf to
your miktex (?) path, AND (!) update the FNDB in miktex. Both versions are
not perfect, the first could give problems when R/Sweave changes (it rarely
does), the second when you install a new version of R. 

Please use line breaks in your messages, you posting was almost unreadable.

3. Associate .tex files with TeXnicCenter and not MikTeX.  Configure Windows
DDE for TeXnicCenter (i.e., open a new .tex file in the already running
instance of TeXnicCenter).  Adapt  the instructions found at
http://www.math.vanderbilt.edu/~schectex/wincd/tips_txc.htm to accomplish
this task.

4. Sweave your .Rnw, Snw, etc. files in R to create the corresponding .tex
files.  Open these files with TeXnicCenter and try to build the pdf files. 
If the Reader issues an error message of the form
[DocOpen("%bm.pdf")][FileOpen("%bm.pdf")] Cannot Execute the Command you may
have to do the following: (A) install new LaTeX packages in MiKTeX rather
than TeXnicCenter or (B) change a few settings in TeXnicCenter to overcome
some well known problems (see
http://www.afterschool.dk/nerd-stuff/latex-adobe-8-crash/ for more details).

-- 
View this message in context: http://n4.nabble.com/LaTeX-R-Sweave-Problems-tp1562533p1563350.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list