I'm using emacs (GNU Emacs 25.1.1 (x86_64-w64-mingw32) of 2016-09-17), and trying to define SumatraPDF as my default PDF-viewer for LaTeX. After some trials, nothing happens, and I have no idea why...

I wrote this in my .emacs-file (just after calling the emacs-leuven configuration ):

(eval-after-load 'latex
     (if (eq system-type 'windows-nt)
           (add-to-list 'TeX-view-program-list
                        '("Sumatra PDF"
                          ("\"c:/Program Files (x86)/SumatraPDF/SumatraPDF.exe\" -reuse-instance"
                           (mode-io-correlate " -forward-search %b %n") " %o")))
           (assq-delete-all 'output-pdf TeX-view-program-selection)
           (add-to-list 'TeX-view-program-selection '(output-pdf "Sumatra PDF"))))))

And this is what I see in the buffer for the customization of the TeX-view-program-list :

'(("Sumatra PDF"
   ("\"c:/Program Files (x86)/SumatraPDF/SumatraPDF.exe\" -reuse-instance"
    (mode-io-correlate " -forward-search %b %n")
    " %o"))
   (concat "\"" "c:/Program Files (x86)/SumatraPDF/SumatraPDF.exe" "\" %o")))

Does someone have any idea what's wrong ?

  • You could try installing Sumatra in a path that doesn't include spaces (e.g., C:\SumatraPDF).
    – Ryan
    Commented Jun 7, 2017 at 18:55

1 Answer 1


It is hard to debug the issue you describe: It would help if you could assemble a minimal scenario how to reproduce this.

Meanwhile, I can suggest the following:

  • Update your AUCTeX to lastest version (11.90.2) from ELPA. It has builtin support for SumatraPDF on Windows.
  • Put the directory c:/Program Files (x86)/SumatraPDF/ into your PATH on Windows.
  • Restart Emacs and check if Emacs finds SumatraPDF by evaluating this line:
    (executable-find "SumatraPDF")
  • Add this single line in your init file, restart Emacs and open your .tex file:
    (setq TeX-view-program-selection '((output-pdf "SumatraPDF")))

Not related to your problem, I think emacs-leuven has a bug here:

(when (or leuven--win32-p leuven--cygwin-p)
  (when (boundp 'TeX-view-program-list)
    (add-to-list 'TeX-view-program-list
                   (concat "\"" ,leuven--sumatrapdf-command "\" %o")))))

Observe where the , is. This way, it adds a concat to TeX-view-program-list which will not work (see your question). The correct way would be:

(when (or leuven--win32-p leuven--cygwin-p)
  (when (boundp 'TeX-view-program-list)
    (add-to-list 'TeX-view-program-list
           ,(list (concat "\"" leuven--sumatrapdf-command "\" %o"))))))

And for your code, I suggest you don't rely on assq-delete-all deleting items from a list. To be on the safe side, do:

(setq TeX-view-program-selection
      (assq-delete-all 'output-pdf TeX-view-program-selection))
  • I already had the latest version, but it worked just fine after adding the directory in the path ! thank you very much
    – bdurillo
    Commented Jun 9, 2017 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.