Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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, second knitr::knit2pdf('$basename.$suffix') (this second changed according to Yihui).

    Preferences for knitr in TeXworks

Then you can choose this processing tool in the main window from the menu “Typeset” or from the toolbar popdown:

TeXworks toolbar, choose processing tool

share|improve this answer
    
perfect thanks @Speravir –  Tahnoon Pasha Dec 2 '12 at 3:15
    
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. –  Yihui Dec 2 '12 at 6:55
    
@Yihui: I think, you are right! As I wrote in the beginning: “… some mistakes are possible”. –  Speravir Dec 2 '12 at 18:44
    
@Yihui BTW: TeXStudio as Texmaker fork should be almost the same, and TeXnicCenter is also very similar! –  Speravir Dec 2 '12 at 19:04
    
@Speravir Thanks! I'll try to test TeXnicCenter some day. –  Yihui Dec 3 '12 at 7:12
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.