This is surely easy-ish to do, but all the advice I can find is either several years old (2012), or not helpful - the Emacs Wiki claims that "Unfortunately, configuration can be tricky to get right, mainly because there are so many steps." Well, I don't mind taking "many" steps, if I only knew which ones to take! Note that I've used Emacs/AucTeX under Linux for years, but for reasons of work I'm having to spend more time in Windows 10.

Anyway, if I could be pointed to a fairly recent set of instructions or examples (of .emacs configurations, for example), I'd be very pleased. Thanks!

  • I think the relevant variable is TeX-view-program-list. You might start there, via describe-variable – Paul Stanley Mar 25 '19 at 11:47

AUCTeX's built-in support for SumatraPDF was improved with the release of version 11.90. So make sure you have the latest version installed, which can be easily done from ELPA.

You need to touch three areas:

Win10's PATH environment variable

This step is optional: Adjust the PATH environment variable and add the directory containing SumatraPDF.exe to it.

Emacs and AUCTeX

You have to adjust two AUCTeX variables: TeX-view-program-list and TeX-view-program-selection. In short, in TeX-view-program-list you define the available viewers and in TeX-view-program-selection, you associate the defined viewers to the document types. If you have SumatraPDF in your PATH, you can skip this step. Otherwise, you have to hardcode the path to the executable in TeX-view-program-list by putting something like this in your .emacs:

(setq TeX-view-program-list
         ("c:/path/to/SumatraPDF -reuse-instance"
          (mode-io-correlate " -forward-search \"%b\" %n")
          " %o")

Now you associate SumatraPDF as viewer for generated .pdf files in TeX-view-program-selection. Again, put this line in your .emacs:

(setq TeX-view-program-selection '((output-pdf "SumatraPDF")))

Finally, make sure you have this line in your .emacs:


Now restart Emacs.


Configuring SumatraPDF is easy. You need to add this line to SumatraPDF preferences for inverse search:

"C:\path\to\emacs\bin\emacsclientw.exe" -n +%l "%f"

If you don't see the field for inverse search, open the file SumatraPDF-settings.txt, search for EnableTeXEnhancements and set it to true. Restart SumatraPDF and try again.

Compiling your .tex file

Open a .tex file, hit C-c C-t C-s and check the message in the Minibuffer. Make sure it says Tex-Source-Correlate mode enabled. Now hit C-c C-c to compile the file and C-c C-v to change to SumatraPDF.

  • Nice answer You are correct to NOT use the old commands -inverse-search It slows down usage but you can also remove -reuse-instance since that should have been set to ReuseInstance = true in SumatraPDF-settings.txt (just need to check via SumatraPDF Settings> Advanced options where you can also check that the InverseSearchCmdLine = your line above. A useful optional setting is HighlightPermanent = true as that persists the pdf highlight until the next call (permanent does NOT mean it is for ever :-) – user170109 Mar 25 '19 at 13:11
  • @KJO - Thanks, my understanding of the question was "Configure AUCTeX and SumatraPDF". Maybe you start a new question with "What is the best setting for SumatraPDF" and collect your hints there? – Arash Esbati Mar 25 '19 at 13:19
  • I have given similar answers to many questions re other editors as many popular answers still rely on old advice e.g. use DDE which is now a bad solution for lack of utf8 support etc.. Your answer is good for Auctex and with dozens of editors a "generic" question would likely invite lots of poor responses MyNotes can get out of date very quickly github.com/GitHubRulesOK/MyNotes/raw/master/AppNotes/SumatraPDF/… and I need to possibly update again in line with your answer – user170109 Mar 25 '19 at 13:51

Just a small comment: if the path to SumatraPDF contains spaces (as is the case for a default install to "Program Files (x86)", then the path must be quoted: "\"c:/Program Files (x86)/SumatraPDF/SumatraPDF\" -reuse-instance" etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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