[ESS] knitr pdf viewer on windows

David Scott d.scott at auckland.ac.nz
Sat Dec 21 05:27:51 CET 2013


Hi Vitalie,

First of all many thanks for all your work on ESS, particularly the 
recent addition of knitr support.

I would prefer not to change the default to SumatraPDF, but it is an 
obvious workaround.

I am pretty clueless when it comes to lisp programming, but I would be 
prepared to do a hack on my ess-swv-PDF in ess-swv.el which is what I 
presume you are referring to.

Is the line:
(cmdstr-win (format "start \"%s\" \"%s.pdf\"" pdfviewer namestem))
the relevant line? Could you suggest a suitable hack?

To consider the problem more generally though, although it is not a bug, 
it seems a bit strange to be able to set the pdf viewer, then to ignore 
it. I am also a little bit mystified as to when ess itself would call up 
the pdf viewer so that the pdf viewer preference is adhered to, or does 
that only occur on platforms other than windows?

Thanks

David Scott


On 21/12/2013 9:31 a.m., Vitalie Spinu wrote:
> Is making SumatraPDF the default on your computer an option?
>
> I looked into the code and, somewhat unfortunately, windows is treated
> specially by calling "start" and ignoring ess-pdf-viewer-pref. I am
> afraid the only way to make it work for you is to rewrite ess-swv-PDF.
>
>     Vitalie
>
>   >>> David Scott on Fri, 20 Dec 2013 13:47:38 +1300 wrote:
>
>   > I am trying to get M-n P when processing a .Rnw file to preferably not open a
>   > viewer, or alternatively open Sumatra if not already open. My preferred mode is
>   > to open the pdf in Sumatra when I start and allow Sumatra to update the pdf as I
>   > edit and then process the .Rnw file.
>
>   > I have changed the sweave processor to knitr:
>   >  '(ess-swv-processor (quote knitr))
>
>   > I have changed the ess pdf viewer to Sumatra:
>   >  '(ess-pdf-viewer-pref "c:/Program Files/RStudio/bin/sumatra/SumatraPDF.exe")
>
>   > Also the AUCTeX pdf viewer:
>   > (setq TeX-source-correlate-mode t)
>   > (setq TeX-source-correlate-method 'synctex)
>   > (setq TeX-view-program-list
>   >    '(("Sumatra PDF" ("\"c:/Program Files/RStudio/bin/sumatra/SumatraPDF.exe\"
>   > -reuse-instance"
>   >                       (mode-io-correlate " -forward-search %b %n ") " %o"))))
>
>   > If I use pdflatex on an ordinary .tex document, I get the Sumatra viewer but M-n
>   > P gives me Adobe Reader  (which is the default on my computer).
>
>   > Any suggestions as to how to change this?
>
>   > Thanks
>
>   > David Scott

-- 
_________________________________________________________________
David Scott	Department of Statistics
		The University of Auckland, PB 92019
		Auckland 1142,    NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:	d.scott at auckland.ac.nz,  Fax: +64 9 373 7018



More information about the ESS-help mailing list