2

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.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. I assume you're using the instructions from Stack Overflow: Sync Emacs AUCTeX with Sumatra PDF? – Mike Renfro Oct 22 '15 at 23:42
  • Yes. As I said, the instruction there works well for single file document. – empenguin Oct 22 '15 at 23:57
  • Never saw a link to the other question, so I wasn't sure if it was the same code, or just similar. How about Is forward search meant to work from an include file? instead? – Mike Renfro Oct 23 '15 at 0:00
  • I think the question you mentioned is different. There, the file variable indicating the master tex is missing. For my question, the file variable has been setted correctly. – empenguin Oct 23 '15 at 0:14
  • Then a basic two-file MWE with a main TeX file, an included TeX file, and minimized AUCTeX configuration may help. I'm not an AUCTeX user any more, but having all the relevant information in one place would help those who are. – Mike Renfro Oct 23 '15 at 0:50
5

If you use arara, make sure at the last step, turn on synctex. See this post. Specifically, use

% arara: pdflatex: { synctex: on } 

instead of

% arara: pdflatex

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.