I use emacs auctex to write latex files. Since the text is pretty long, and I tend to change things in different places, I would like emacs to open the pdf so that the position in the text is shown that the cursor is at in the source file.

I have seen this on a windows machine with MikTex/Texniccenter/Acroreader. Is it possible to do this on Ubuntu in emacs/auctex/evince?

2 Answers 2


To do this you need add the following lines to your .emacs file so that when you view the pdf using evince it will tell evince the page number:

(setq TeX-view-program-list '(("Evince" "evince --page-index=%(outpage) %o")))
(setq TeX-view-program-selection '((output-pdf "Evince")))

Then once you've opened your tex file in emacs you need to turn on source correlation using the command:

C-c C-t C-s

Or if you don't want to start it manually every time then add the following line to your .emacs:

(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)

Also, if you want to prevent emacs from promting you if you want to start a correlation server then add the following line:

(setq TeX-source-correlate-start-server t)

And that should be it.

Edit: actually, it turns out that you shouldn't use the package pdfsync, so I've removed all reference to it. It isn't needed for this solution (apparently it's now built into all TeX-based engines) and using it actually seems to cause problems (for me it seems to break code using tables).

Edit 2: I was having problems with auto-enabling TeX-source-correlate-mode using .emacs, but now they seem to have gone. Not sure if that's because I updated emacs or because I removed pdfsync. Anyway, that works now :)

  • @dbddkmezz How to I open the pdf from Emacs then? C-c C-v doesn't do it.
    – dustin
    Apr 9, 2013 at 20:33
  • @dustin C-c C-v works for me. Maybe you need to set up your pdf viewer a bit?
    – xuhdev
    Dec 17, 2015 at 4:47
  • It doesn't work if I use latexmk to compile tex to pdf.
    – CodyChan
    Oct 21, 2016 at 10:37

I used the description given at http://www.emacswiki.org/emacs/AUCTeX (the last section: Synctex and Evince), worked like a charm... with this you get two way syncing (e.g. hit C-c C-v in emacs to go the pdf page or hit C-mouse1 in evince to go to correct spot in emacs). Overall it's similar to the first answer, but you don't need to include pdfsync by hand and emacs and evince use dbus to communicate. You do have to do C-c C-t C-s too though.

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.