Dear All: For a few days now I have struggled with recreating a stable LaTeX/R/Sweave environment on a new Windows XP SP3 machine. Unfortunately it seems that I ran out of good ideas and I would like your expert opinion on how I should approach this task and be successful. In essence, I installed (several times) in this order the following: R2.10.1 (and then R 2.9.2), Adobe Acrobat Reader 9 (and then Reader 8.2 and 7.0), MiKTex2.8, GhostScript8.64, GhostGum with GSview 4.9 and the latest version of TeXnicCenter. With all versions of R, I appended the path to the R executables to the path environmental variable. To overcome the fact that the R installation had spaces in the path, I just had the corresponding Sweave.sty in the folder where my .Rnw and .tex files were located and used \usepackage{Sweave} in the preamble of the .Rnw file. When I do not use Sweave everything seems to work just fine. The .Rnw files are sweaved in R just fine and then the corresponding .pdf files are built correctly. This changes dramatically though when I call Sweave in the preamble of the .Rnw file. As before, the tex file is generated correctly but when I try to build the pdf file the Reader issues an error message that states [DocOpen("%bm.pdf")][FileOpen("%bm.pdf")] Cannot Execute the Command and does not produce anything. I found several online recommendations on how to fix this problem but none worked. Am I missing something obvious here? Has anyone experienced this before and found a fix? Thank you so much. Tudor -- View this message in context: http://n4.nabble.com/LaTeX-R-Sweave-Problems-tp1562533p1562533.html Sent from the R help mailing list archive at Nabble.com.
tudor wrote:> > ... To overcome the fact that the R installation had spaces in the path, I > just had the corresponding Sweave.sty in the folder where my .Rnw and .tex > files were located and used \usepackage{Sweave} in the preamble of the > .Rnw file. >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. Dieter -- View this message in context: http://n4.nabble.com/LaTeX-R-Sweave-Problems-tp1562533p1562751.html Sent from the R help mailing list archive at Nabble.com.
> > To overcome the fact that the R installation had > spaces in the path,The easiest way to deal with spaces is to use the 8.3 names in your paths.>From the DOS CMD window, enterdir /x and you will get the 8.3 names. For example dir /x/ad c:\pr* cd c:\progra~1\R dir /x/ad R-2.10.* Based on this information, I can now write in R notation (with forward slashes) c:/progra~1/R/R-2.10.1 instead of the longer name "c:/program files" Rich [[alternative HTML version deleted]]
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.
Apparently Analagous Threads
- Sweave and Miktex (Sweave.sty not found)
- Sweave: problem with usepackage{C:/PROGRA~1/R/R-27~1.0/share/texmf/Sweave}
- running texi2dvi without running bibtex
- dealing with sweave.sty and pgfSweave
- Windows problem related to using shortPathName for Sweave style file