[ESS] knitr pdf viewer on windows

David Scott d.scott at auckland.ac.nz
Mon Dec 23 01:25:58 CET 2013


On 21/12/2013 7:52 p.m., Vitalie Spinu wrote:
> Actually the code looks ok. The ess-pdf-viewer-pref should take
> effect. Could you please report what is reported by
>
>     M-: (ess-get-pdf-viewer)
"SumatraPDF.exe"

>
> Also check that if you call from emacs shell or windows terminal:
>
> start "c:/Program Files/RStudio/bin/sumatra/SumatraPDF.exe" "some_file.pdf"
>
> it really works.
Opens the file with Adobe Reader!

SumatraPDF "some_file.pdf"
SumatraPDF.exe "some_file.pdf"
both open the file with SumatraPDF.
>
> You can inspect what is going wrong with ess-swv-PDF yourself. Go to
> that function and instrument with C-u C-M-x. Then call it from rnw
> buffer. The debugger will start and you should press n till you reach
> the calling part. Then you can inspect all variables and expressions by
> executing C-x C-e at the end of those.
>
It seems to have the right variable values all the time, but when it 
gets to
(shell-command cmdstr-win)
the pdf file just opens up with Adobe Reader. All the variables are 
showing SumatraPDF as what to use.

I tried changing the viewer to just "SumatraPDF.exe"without the path for 
both Sweave and AUCTeX, based on the experiment in the shell above, but 
no joy. Just another wonderful feature of Windows I guess.

In desperation I resorted to an ugly hack which seems to have worked. I 
commented out the line
(shell-command cmdstr-win)
in ess-swv.el and byte compiled the result. Now the pdf viewer is not 
invoked, but that is fine for me. I just open the pdf file with 
SumatraPDF before I use knitr and pdflatex.

Thanks for the advice on debugging, it meant I was able to find the code 
which opened the pdf viewer.

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