There is a great piece on Yihui's site about using knitr with TeXShop. Taking some time for some self indulgent curiosity here. Is there a way to use knitr as an engine in TeXworks?
1 Answer
You can add knitr as additional engine into TeXworks similar as already shown on the linked demo page for Texmaker (note: I do not know knitr at all and also I’m not a regular user of TeXworks, so some mistakes are possible):
Edit: Yihui added instructions for TeXworks to the already mentioned page Editors for knitr.
Open the “Preferences” window (can be found in the “Edit” menu) and go to the “Typesetting” tab.
(For next steps see image below.)
Then (step 1 one the image) add a new Processing Tool. In the new window give it a name (step 2) and add the executable file (step 3). Last add the needed arguments (step 4); you can add more than one by repeated pressing the plus sign. I also marked the TeXworks variable
$basename
, there exists a$fullname
as well. Press OK.Edit: And I made a mistake: The arguments must be splitted into two – first argument
-e
, secondknitr::knit2pdf('$basename.$suffix')
(this second changed according to Yihui).
Then you can choose this processing tool in the main window from the menu “Typeset” or from the toolbar popdown:
-
I just added the link to this answer in yihui.name/knitr/demo/editors; for some reason I had to put
-e
and"knitr::knit2pdf(...)"
in two lines under Ubuntu in the arguments; not sure if it has to be the case under Windows as well. Dec 2, 2012 at 6:55 -
@Yihui: I think, you are right! As I wrote in the beginning: “… some mistakes are possible”.– SperavirDec 2, 2012 at 18:44
-
@Yihui BTW: TeXStudio as Texmaker fork should be almost the same, and TeXnicCenter is also very similar!– SperavirDec 2, 2012 at 19:04
-
-
@Yihui: But don’t forget, it’s a Windows program. I don’t know, whether it runs in wine.– SperavirDec 3, 2012 at 21:17