Forward inverse search work properly for single-file documents. As for multifile document, I use local file variable to indicate the master tex
file. When editing in some included document, auctex can correctly compile it and view it using Sumatra. However, the forward search and inverse search do not function as expected. Sumatra always locates the pdf to the last position I viewed. Besides, there is no response for double click in Sumatra with inverse search activated.
I noticed that the view command passed to Sumatra goes as follows:
"C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe" -reuse-instance -forward-search chap3.tex 4 "thesis-main.pdf"
Seems no problem. But why doesn't Sumatra go to the right place? My configuration code for auctex:
(setq TeX-source-correlate-mode t)
(setq TeX-source-correlate-method 'synctex)
;; (setq TeX-source-correlate-start-server t)
;; use Sumatra PDF to preview pdf
(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
'(progn
(assq-delete-all 'output-pdf TeX-view-program-selection)
(add-to-list 'TeX-view-program-selection '(output-pdf "Sumatra PDF"))
(add-to-list 'TeX-command-list
'("Arara" "arara %s" TeX-run-TeX nil t :help "Run Arara."))))
My environment of emacs: windows 10 + emacs24 64bit + Sumatra
Update1:
I tested a simple document of class article which includes a sub document. The forward and backward search work fine, so the problem must be related to my original document. It uses a customized template and some packages. I am struggling to identify which blocks the function of forward and inverse search. Any suggestions?
Update2: It is about the arara command I used. See my answer.