0

First of all, followed some helpful answers, at Inverse search with Emacs/AucTeX and SumatraPDF [on Windows 10] , which sums it up nicely. However it is possible to set the inverse command for sumatra directly. Which is convenient when using multiple latex editors (not decided which is best jet)

The problem:

  • auctex resolves the %f and %l before passing it to sumatra pdf

My config:

~\.emacs.d\latex.el

;; 
;; LaTeX specific settings
;;

(add-hook 'LaTeX-mode-hook (lambda ()
  (linum-mode t)
))

(setq-default TeX-master nil)

(setq-default TeX-parse-self t) ;; Enable parsing of the file itself on load
(setq-default TeX-auto-save t) ;; Enable save on command executation (e.g., LaTeX)
(setq-default TeX-save-query nil) ;; Don't even ask about it

;; latex options
(setq-default TeX-command-extra-options "-shell-escape") ;; Enable shell escape option by default

;; Synctex for windows
(setq-default TeX-source-correlate-mode t) ;; Enable synctex
(setq-default TeX-source-correlate-start-server t)


(setq TeX-view-program-list
'(("Sumatra PDF" ("\"C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe\" -reuse-instance"
   (mode-io-correlate " -forward-search %b %n -inverse-search \"emacsclientw.exe -n +%l %f\"") " %o"))))

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

(server-start)
  • 1
    Untested: Try it with doubled %% at those relevant places, i.e. %%l %%f. – Arash Esbati Apr 21 '16 at 20:06
  • YES! @ArashEsbati's solution works nicely! – Marciano Siniscalchi Oct 11 '16 at 2:47
1

Setting up Auctex with SumatraPDF for forward and inverse search turned out to be quite a challenging task (after a Windows 10 OS reinstall on my machine). There is lots of information available but a lot of it is obsolete and incomplete and does not necessarily indicate how to do the set up in the latest Auctex (12.1). For setting up SumatraPDF and forward search the best place for the information is the following blog (rather hard to discover by searching): http://www.barik.net/archive/2012/07/18/154432/

For the inverse search the suggestions elsewhere on StackExchange work fine by setting the command line for inverse search in SumatraPDF as (the equivalent for your installation of): "C:\Program Files (x86)\GNU Emacs 24.5\bin\emacsclientw.exe" -n +%l "%f"

I'm still working on setting up the dvi viewer and inverse search (I need to alternatively work with both dvi and PDF output).

It would be great to have this information all in one consolidated form. Years ago, one could find a website with complete information for set up of emacs, Latex, AucTex, Yap, and forward/inverse search. At the moment, it seems this information is really scattered all around.

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.