Skip to content

Sweave not found from MikTeX?

3 messages · Jeff D. Hamann, Henrik Bengtsson, Achim Zeileis

#
I've been working on a LaTeX document that contains Sweave code and cannot
get MikTeX to find the Sweave.sty file. I've added the c:\rw1081\share\texmf
path in the MikTeX roots (I've ven added the path in the environment
variables ) but to no avail. Is there a trick to getting Sweave installed
correctly when using MikTeX on Windows XP? Do I need to move/copy the
Sweave.sty file to the c:/textmf/?/?/? directory?

Jeff.

---
Jeff D. Hamann
Forest Informatics, Inc.
PO Box 1421
Corvallis, Oregon USA 97339-1421
(office) 541-754-1428
(cell) 541-740-5988
jeff.hamann at forestinformatics.com
www.forestinformatics.com
#
Hi, I think about everyone asks the same question as you. A quick and
dirty way to fix it is to copy Sweave.sty from$R_HOME/share/texmf/ to
the same directory as your Sweave/R/TeX files. 

BTW: Would it be possible to add a comment about the above in the
Sweave() help page and maybe even have an argument "copySty=FALSE"
that finds $R_HOME/share/texmf/Sweave.sty and copies it automatically?


Personally, I actually prefer to copy the file this way, because then
I can be sure that the Sweave report will be generated without problem
if I send it to someone else.

About MikTeX: You want to update you TeX-database (or whatever it's
called). Did you go into "MikTeX Options" and did "Refresh Now" under
"File name database"? It's not enough do run "Add..." the path.

Cheers

Henrik Bengtsson
Hamann
#
On Fri, 20 Feb 2004 09:53:31 +0100 Henrik Bengtsson wrote:

            
If I want to send the resulting TeX files to someone else, e.g., a
journal, then I usually just put the necessary declarations into the
header of the .Rnw (and resulting TeX) file:

-------------

\documentclass{article}
\usepackage{foo,bar}

%% instead of \usepackage{Sweave}
\RequirePackage[T1]{fontenc}
\RequirePackage{graphicx,ae,fancyvrb}
\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}
\setkeys{Gin}{width=0.8\textwidth}
\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}
\newenvironment{Schunk}{}{}

\begin{document}
...

-------------

When calling Sweave() it looks whether you already have included some
Sweave.sty into your document and only adds a line like
  \usepackage{path/to/Sweave.sty}
if you haven't. It doesn't mind that the line itself is escaped via %%.

Best,
Z