I've been looking everywhere, but my computer (Windows 7) just won't install the Sweave.sty package for Miktex 2.9. I tried to put it in a folder respecting the TDS standard, and then to install it, locally. The Package Manager won't accept any folder I suggest as a local package repository

error: this folder doesn't seem to be a local repository.

I added the direction to the roots, but it just won't find the sweave.sty package. I updated the database several times, with the texhash prompt in the console, and using the button.

I tried to follow the instructions on: https://stat.ethz.ch/pipermail/r-help/2010-February/229033.html and http://docs.miktex.org/manual/localadditions.html

It always gives me the same error message:

Package Sweave could not be found.

On my other computer I have a local repository in the User folder, and I always have to put the directory of the Sweave file in the preamble of my document. At least, that works, but as I would like to keep my file reproducible, I would prefer to know how to properly install Sweave. Maybe its because I changed the basic directory shown in the console to the local folder where my LaTeX document is.

I use the WinEdt editor. Maybe it has something to do with Ghostscript, I have no idea whether this is installed or what it is used for. I try to find out about that next.

Can anyone give me a hint what to try next? I tried to be as precise as I could.

  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. Note that you don't have to sign with your name since it automatically appears in the lower right corner of your post. Jun 4, 2013 at 15:03
  • Never heard of this WinEditor, what is it? Jun 4, 2013 at 15:31
  • @karlkoeller I guess the correct name is WinEdt 6, it is my editor. Probably an alternative to the TeXnicCenter described in the solution that I posted.
    – Angelika
    Jun 4, 2013 at 16:01
  • Oh well, I thought it was WinEdt, but googling I've found an editor called WinEditor and I had a doubt... Anyway, if you want to use Sweave with WinEdt, have a look at the R-Sweave add-on. In the help you will also find instructions on how to setup Sweave to work from within WinEdt. Jun 4, 2013 at 16:05
  • This is probably the five hundred and seventy-eighth time that people have asked about the very confusing Sweave.sty. Why not forget about it and use the knitr package instead?
    – Yihui Xie
    Jun 4, 2013 at 19:09

2 Answers 2


I finally changed all my documents to knitr, now everything works fine, even if I lost a lot of time. My problem was not adding the roots to my database, but I didn't find out what it was. The Database updating worked out on the other computer, but my computer just won't install Sweave.


What I suggest is to create a local TEXMF tree in MiKTeX, for example in the directory C:\Local.

After that, create the path C:\Local\tex\latex\misc and copy Sweave.sty there.

At this point, open the admin version of MiKTeX Settings program, and, in the 'Roots' tab, press 'Add' and select the directory C:\Local. Now press 'OK' and MiKTeX automatically inserts C:\Local in the TDS as a local tree.

If you now add the line


in your document, Sweave is found by MiKTeX.

Moreover, since you are using WinEdt as your editor, I suggest you to download the R-Sweave add-on by Gilbert Ritschard that lets you use Sweave from within WinEdt (a very useful package). The version for WinEdt 7/8 also adds support for knitr, if you're interested in it.

  • I found and tried out this solution before. I swear I did what you said, it still won't work out. I found that solution in different blogs, too. It didn't work using [link](C:\LocalTexFiles) instead of [link](C:\Local) neither. I will, however, update my WinEdt version and install the addon. Then, I will try out knitr.
    – Angelika
    Jun 4, 2013 at 21:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .