I've been trying to use Emacs/AucTeX along with SumatraPDF to view my output. In particular, I would like to make the forward and inverse search work. I use Windows 10.


Every time I double click something in my pdf output, a new instance (or a new window) of Emacs opens. Once at least one instance has .tex file opened, the following instances give the following message:

Warning: desktop file appears to be in use by PID 5132. Using it may cause conflicts. Use it anyway? (y or n)

Regardless of my decision (y/n), I get new instances of Emacs with my .tex file open after every subsequent double click in my pdf output file.

I believe I should be redirected to a proper place in an opened .tex file in Emacs instead.

My current configuration

Here's what I added to my .emacs:

(setq TeX-PDF-mode t)
(setq TeX-source-correlate-mode t)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-view-program-list
'(("Sumatra PDF" ("\"C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe\" -reuse-instance"
   (mode-io-correlate " -forward-search %b %n ") " %o"))))

(eval-after-load 'tex
   (assq-delete-all 'output-pdf TeX-view-program-selection)
   (add-to-list 'TeX-view-program-selection '(output-pdf "Sumatra PDF")))

My "Set inverse search" command in SumatraPDF:

"C:\Program Files (x86)\GNU Emacs 24.5\bin\runemacs.exe"  +%l "%f" 

Help will be greatly appreciated.

Disclaimer: I am new to Emacs -- sorry if my question is trivial.

  • 4
    Set (server-start) in your init file and try this command in SumatraPDF: "C:\Program Files (x86)\GNU Emacs 24.5\bin\emacsclientw.exe" -n +%l "%f" – Arash Esbati Jan 5 '16 at 9:11

Arash's suggestion in the comment above has solved the problem for me.

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.