Since I have setup SumatraPDF to automatically refresh PDFs when they change, how can I suppress "view" (resulting in opening a new instance of the pdf) when using the shortcut

M-n P (running pdfLaTeX) in Emacs with AucTeX installed.


  • 1
    I suspect this is linked to the editor you use: which one?
    – Joseph Wright
    Commented Sep 1, 2012 at 12:47
  • @JosephWright Emacs, problems are with auctex (it normally worked). Commented Sep 3, 2012 at 9:46
  • M-n P is not a defined shortcut on my version of AucTex. What command does that binding run for you?
    – Tyler
    Commented Dec 17, 2012 at 18:08

2 Answers 2


M-n P calls ess-swv-PDF (which is part of the ESS package), which includes a hard-coded call to your pdfviewer. However, you can customize the viewer it will use, which is stored in the variable ess-pdf-viewer-pref. Setting this to a no-op, like ":", should effectively suppress the 'view' command.

M-x customize-variable ess-pdf-viewer-pref <RET> and set the value there.


When ess-swv-PDF runs, it calls ess-get-pdf-viewer, which

"gets external PDF viewer to be used from ESS. Use ess-pdf-viewer-pref when that is executably found by M-x executable-find. Otherwise try a list of fixed known viewers."

In other words, even if the variable ess-pdf-viewer-pref is set to nil, a fixed known viewer is searched for. Unfortunately this means the only way to prevent ess-swv-PDF from displaying the pdf is to redefine or modify the function.

  • Welcome to TeX.sx! Posts from new users are required by the system to be reviewed and possibly edited to help with any problems. Commented Mar 4, 2013 at 17:48
  • The documentation for ess-get-pdf-viewer is not correct. From the code in the ESS version I have, what actually happens is "Use ess-pdf-viewer-pref when set. Otherwise try a list of fixed known viewers". The (executable-find ess-pdf-viewer-pref) line has been removed. This is with ESS version 12.09-2.
    – Tyler
    Commented Mar 4, 2013 at 20:49
  • It does still try the list of fixed known viewers though, so the solution to just set ess-pdf-viewer-pref won't stop a pdf viewer from being opened when you do a M-n P. Your solution worked for the questioner because s/he was using SumatraPDF and doens't have one of the "fixed known viewers" installed. I'm also using ESS version 12.09-2 and, for reference, that list of fixed known viewers is evince, kpdf, okular, xpdf, acroread, and xdg-open.
    – jrm
    Commented Mar 8, 2013 at 2:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .