             args    : [@base_filename]
             timeout : 10
             cb      : (err, output) =>
+                if err
+                    cb?(err)
+                else
+                    log = output.stdout + '\n\n' + output.stderr
+                    @_need_to_run.latex = true
+                    cb?(false, log)
+
+    _run_knitr: (cb) =>
+        @_exec
+            command  : "echo 'require(knitr); knit(\"#{@filename_rnw}\")' | R --no-save"
+            bash     : true
+            timeout  : 60
+            cb       : (err, output) =>
                 if err
                     cb?(err)
                 else

        if not opts.latex_command?
            opts.latex_command = @default_tex_command()
        @_need_to_run =
            latex  : true   # initially, only latex is true
            sage   : false  # either false or a filename
            bibtex : false

    pyx    : 'python'
    r      : 'r'
    rmd    : 'gfm2'
    rnw    : 'stex2'
    rst    : 'rst'
    rb     : 'text/x-ruby'
    ru     : 'text/x-ruby'
