[R] Sweave not found from MikTeX?

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Fri Feb 20 11:18:30 CET 2004


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

> 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.

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

 
> 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
> 
> 
> > -----Original Message-----
> > From: r-help-bounces at stat.math.ethz.ch 
> > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jeff D.
> Hamann
> > Sent: den 20 februari 2004 02:34
> > To: r-help at stat.math.ethz.ch
> > Subject: [R] Sweave not found from MikTeX?
> > 
> > 
> > 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
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list 
> > https://www.stat.math.ethz.ch/mailma> n/listinfo/r-help
> > PLEASE 
> > do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> > 
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list