[ESS] knitr

Vitalie Spinu spinuvit at gmail.com
Thu Jun 7 16:39:06 CEST 2012


  >> Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>
  >> on Thu, 07 Jun 2012 15:24:25 +0100 wrote:

  > Neat, thanks Rodney!
  > A further OT point, following up to Vitalie's eg of rendering a beamer
  > frame, I hacked Emacs to render just the current slide at point (bound
  > to M-C-x -- it seemed like a pretty good analog of  eval-defun to me!)

  >   http://www.damtp.cam.ac.uk/user/eglen/emacs/beamer.txt

Actually I had in mind precisely this hack which I have been using for
more than an year since I stumbled upon it. Thanks. It's hugely handy
with docview (with .div output it's faster).

The annoying part is that it doesn't work when there are code chunks
inside a frame. Hence the original request of partial evaluation. Being
OT it becomes OT (on topic) again ...

  > Now with Rodney's info below, we could do away with xpdf and use docview
  > to render the resulting pdf slide!

  > Stephen

  > Rodney Sparapani <rsparapa at mcw.edu> writes:

  >> On 06/07/2012 08:43 AM, Yihui Xie wrote:
  >>> Yes, I did not expect partial evaluation when I designed knitr, and
  >>> this sounds like a good idea. Given the current design (parser +
  >>> evaluator + renderer), I do not think it is hard to allow partial
  >>> evaluation of a single chunk and return a character string for that
  >>> chunk. My question is what you are going to do with this partial
  >>> result; it is not a complete LaTeX document.
  >>> 
  >>> That being said, I believe the cache feature might be an alternative
  >>> solution. The main reason that you do not want to compile the whole
  >>> document is probably about speed. If you enable cache in knitr, it
  >>> will not take much time on R's side to knit the document. With a PDF
  >>> viewer like Evince (but not Adobe Reader), you can keep the viewer
  >>> open and stay at the page that you want to read; when you knit the
  >>> file again, the page will be updated, so it feels like you are only
  >>> knitting the current page.
  >>> 
  >>> Regards,
  >>> Yihui
  >> 
  >> Slightly OT...
  >> 
  >> I just wanted to add that I have been playing around with DocView
  >> in Emacs and I have dumped Evince and Adobe Reader for most of my
  >> AUCTeX PDF viewing.  Like Evince, the viewer stays at the current
  >> page while it refreshes, although, it is not real fast.  The beauty
  >> of DocView (like Emacs itself) is that you can customize it:
  >> 
  >> (require 'doc-view)
  >> 
  >> (defun doc-view-revert-buffer-no-confirm ()
  >> "type r or mouse button 1 to revert a PDF without asking for confirmation"
  >> (interactive)
  >> (doc-view-revert-buffer nil t))
  >> 
  >> (defun doc-view-enlarge-2 ()
  >> "type 2 to double DPI, i.e. enlarge"
  >> (interactive)
  >> (doc-view-enlarge 1.9))
  >> 
  >> (setq doc-view-continuous t)
  >> 
  >> (define-key doc-view-mode-map [(C-home)] 'doc-view-first-page)
  >> (define-key doc-view-mode-map [(C-end)] 'doc-view-last-page)
  >> (define-key doc-view-mode-map (kbd "r") 'doc-view-revert-buffer-no-confirm)
  >> (define-key doc-view-mode-map [(mouse-1)] 
  >> 'doc-view-revert-buffer-no-confirm)
  >> (define-key doc-view-mode-map (kbd "2") 'doc-view-enlarge-2)
  >> 
  >> (add-hook 'doc-view-mode-hook 'auto-revert-mode)
  >> 
  >> ______________________________________________
  >> ESS-help at r-project.org mailing list
  >> https://stat.ethz.ch/mailman/listinfo/ess-help

  > ______________________________________________
  > ESS-help at r-project.org mailing list
  > https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list