I am working with Xbuntu 12.04 on a MacBook Air 4,1. I have Okular version 0.14.3 and TeX Live 2011 installed.
I used to have perfect forward (from .tex to .pdf) and backward (from .pdf to .tex) search/sync with synctex. For some reason, it stopped working (it might be the case that I was actually originally using TeX Live 2009 which is the default under Ubuntu). Neither forward, nor backward search works anymore.
The funny thing is, backward search still worked for a specific .pdf I had (an old, unchanged one). But when I hit the text selection tool in Okular, it stopped working afterwards. I even recompiled the .tex, again, not working anymore.
Here is the old setup that used to work:
This is taken from Setup SyncTeX with Emacs
1) Set up Okular: Okular -> Settings -> Editor -> change to Emacs client
2) Put in ~/.emacs:
(defun Okular-make-url () (concat "file://" (expand-file-name (funcall file (TeX-output-extension) t) (file-name-directory (TeX-master-file))) "#src:" (TeX-current-line) (expand-file-name (TeX-master-directory)) "./" (TeX-current-file-name-master-relative))) (add-hook 'LaTeX-mode-hook '(lambda () (add-to-list 'TeX-expand-list '("%u" Okular-make-url)))) (setq TeX-view-program-list '(("Okular" "okular --unique %u"))) (setq TeX-view-program-selection '((output-pdf "Okular") (output-dvi "Okular")))
The question is rather simple: How can Okular (and ~/.emacs) be set up correctly to have forward and backward search with synctex (under TeX Live 2011)?
I found https://stackoverflow.com/questions/6898710/emacs-auctex-rewriting-the-okular-make-url-function-to-work-with-new-synctex-f/6904563#6904563 and tried the suggested answer. So I
1) created the "expander" as mentioned
2) put the following in ~/.emacs:
(setq TeX-view-program-list '(("Okular" "okular --unique %o#src:%n%(dir)./%b"))); %o: TeX-output-extension; %n: TeX-current-line; %b: TeX-current-file-name-master-relative
Still, no luck. I then figured I try to start Okular from the command line to see if it can open a .pdf and display a certain line. I played with several combinations of type
okular --unique myfile.pdf#src:200/home/myuser/mypath-to-folder-of-myfile/./myfile.tex. This opens Okular, but does not jump to line 200. It just opens the first page. So this is certainly a starting point for a fix, but I don't know how.
Any ideas on how to solve this?
In case this matters, I've installed TeX Live 2011 via
install-tl-unx.tar.gz from http://www.tug.org/texlive/acquire-netinstall.html (just some weeks ago)
I just realized that my old setup as described above perfectly works for all files where I have a
myfile.synctex.gz file in the current directory. Those files I newly create via
pdflatex are missing the
.synctex.gz, so that seems to be a (maybe the) problem. Not sure what the problem is here.