Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

Old setup

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")))

Problem

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)?

Trial

I found http://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)

UPDATE

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 latexmk/pdflatex are missing the .synctex.gz, so that seems to be a (maybe the) problem. Not sure what the problem is here.

share|improve this question
    
can you pust your setup for latexmk? I put in your code for okular which no works but it broke my code for latexmk. –  dustin Apr 9 '13 at 20:52
    
Hi dustin. I'm sorry but I don't have it anymore (I work on a different architecture/setup now). But as I said below, I posted it somewhere else, just look for that post. –  Marius Hofert Apr 9 '13 at 21:16
    
I most likely was this: tex.stackexchange.com/questions/60181/… –  Marius Hofert Apr 9 '13 at 21:17
add comment

1 Answer

Okay, I found the error. Indeed .synctex.gz was not written anymore. That happened because I specified an additional argument to latexmk. I'll address this in another post, it's too specific and not related to this problem anymore.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.