I have written about LyX, RStudio, Emacs Org-mode and Eclipse. There are still other editors that we can use with knitr, such as Texmaker and WinEdt. The key is that you call R and load the knitr package, then call the function
You can define a custom command to process Rnw documents by
User --> User Commands --> Edit User Commands:
Note if you have not added R’s bin path to the
PATH variable, you need to use the full path to
Rscript.exe in the above command like:
"C:/Program Files/R/R-2.14.2/bin/Rscript.exe" -e "knitr::knit2pdf('%.Rnw')"
If you do know where is
Rscript.exe, simply open R and use
R.home('bin') to find it. Then for an Rnw document, you can use this
knitr command to compile it:
Click the arrow on the left to compile the document, and the right arrow to view PDF. Of course the above configuration is for Windows, but it is straightforward for other systems as well: change
Rscript (in fact you can use
Rscript under Windows as well).
It is basically the same thing as Texmaker (thanks, Henrik Nyhus and Paul J. Hurtado):
The WinEdt mode R-Sweave supports knitr now. Please read on if you want to configure WinEdt by yourself instead.
The following instructions were from Phil Chalmers, and I did not test them at all, but I feel it should be in the ballpark.
- Go to
Options -> Execution Modes -> PDFTeXify. Then look for executable
C:\Program Files\R\R-2.14.2\bin\Rscript.exe) and select that.
-e, and under
F9 will run everything for you at once, including opening up the PDF.
Since 12.09, knitr has been officially supported in ESS. If you are using Debian/Ubuntu, you can install it by
Below is a short video showing how to use knitr in ESS:
You can define external tools in gedit. Thanks to the tip from David Allen below, you may knit a document via
Rscript -e "library(knitr); knit('$GEDIT_CURRENT_DOCUMENT_NAME')"
The KnitrSublime package by Andrew Heiss provides very rudimentary LaTeX support for knitr in Sublime Text 2.
The Vim-R-Plugin has comprehensive support to knitr thanks to Jakson Aquino.
It is easy to configure TeXShop to work with knitr; just save the code below as a file
Knitr.engine under the
Engines directory of TeXShop (usually
TeXworks is similar to Texmaker in terms of configuration for additional tools. Below is a screenshot of the configuration under Ubuntu, thanks to Speravir for the answer on StackExchange (Windows/Mac OS should be similar, as long as
Rscript is in
The following method was pointed out by tirip01 in the comments below:
Finish. In the
Commandfield. Below, in the
Advancedtab and set Rnw as
Source extensionand pdf as
In menu select
Dr Marek Gągolewski also has a blog post Configure Kile for knitr under GNU/Linux, which describes a more complicated approach.
Tinn-R started to support knitr since v18.104.22.168.