This dose not work when the tex file name contains space or some of its parent directories' name contains space.

Quote Originally Posted by Ben___ View Post
Hi!

For all of you who didn't get forward/backward search to work. Here is my solution. Thanks to José Aliste who wrote gedit-synctex-plugin:

Preamble

  1. Download these files
  2. deflate them to ~/bin (or something within $PATH)


Backward Search (Evince → Editor)

  1. Adopt the first line of »~/bin/evince« (EDITORCMD) to your needs. (run »evince_backward_search« to get help for possible entries)
  2. Compile your .tex File with synctex (»pdflatex -synctex=1 myfile.tex«)
  3. Run »evince myfile.pdf« (The script should run evince_backward_search and evince)
  4. click on some text in evince with »Ctrl+leftclick«
  5. the editor should jump to the corresponding line


Forward Search (Editor → Evince)

  1. you have to tell your editor, to run »evince_forward_search $PDFFILE $LINE $TEXFILE« when pressing some key.
  2. go to some line in your editor and press the key
  3. evince should mark the corresponding line



in my case (using vim-latexsuite), I wrote in ~/.vim/ftplugin/tex.vim:

Code:
function! Tex_ForwardSearchLaTeX()
  let cmd = 'evince_forward_search ' . fnamemodify(Tex_GetMainFileName(), ":p:r") .  '.pdf ' . line(".") . ' ' . expand("%:p")
  let output = system(cmd)
endfunction
Afterwards you can do forward search in vim with \ls

Ben

edit: thanks to hugmenot, I changed the code according to your comment