I just updated R to 3.0.0. I couldn't compile PDF from my .Rnw file, which I could do with R 2.15. Here is the error I got:

! Undefined control sequence.
l.192 \SweaveOpts
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

It seems related to Sweave. But I was using knitr to weave .Rnw file. Could some one help me fix the problem?

  • 1
    Welcome to TeX.sx! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you.
    – Mensch
    Commented Apr 12, 2013 at 14:23
  • It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The StackExchange staff can merge them together for you.
    – Werner
    Commented Apr 13, 2013 at 3:15

1 Answer 1


Remove \SweaveOpts{concordance=TRUE} in your Rnw file. It is invalid and useless to knitr.

Update: I have fixed the plot problem in the development version (v1.2.4). See here for instructions on installation. It will go to the stable version 1.3 eventually, but perhaps not until a month later.

  • Yihui, Thank you so much for your quick response. I removed \SweaveOpts{concordance=TRUE} from the Rnw file, which was put in my Rnw file by Rstudio when Preference -> Sweave -> "Always enable Rnw concordance (required for syntex)" was checked. I had to uncheck that option. The error is gone. But I still have problem to compile PDF file with some warnings. I will try to figure it out later. [Update 4/13/13]: The problem is knitr generated two figure PDFs for one code chunk. And the first PDF has no page, which causes the following error: !pdfTeX error: /usr/texbin/pdflatex (file ./figure/minim
    – user28957
    Commented Apr 13, 2013 at 2:07

You must log in to answer this question.

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