samedi 29 novembre 2014

Vim-Latex: forward search doesn't work


I know people have had this kind of problem before, but I haven't been able to find the solution to my problem anywhere.


First of all, calling Tex_ForwardSearchLatex() with <leader>ls doesn't work. A command pops up and disappears (which, I suppose, is the viewer being called from the shell), but nothing happens. If the viewer is not already open, then this doesn't open the viewer.


So I tried a custom function from this thread, with the same result.



function! SyncTexForward()
let execstr = "silent !okular --unique %:p:r.pdf\\#src:".line(".")."%:p &"
exec execstr
endfunction
nmap <Leader>f :call SyncTexForward()<CR>


This solution is not supposed to work with \input and include subdocuments, but I'm not even there yet. I'm just trying to get the main document to work.


Then I tried a modified version of the custom function that supposedly works with subdocuments as well, but again to no avail.



function! SyncTexForward()
let execstr = "silent !okular --unique %:p:r.pdf\#src:".line(".")."%:p &"
exec execstr
endfunction
nmap <Leader>f :call SyncTexForward()<CR>


I thought it might be a problem with spaces in my file/directory names, but no. I've tried a file called test.tex at root with the same result. SyncTex is enabled and the viewers are on the path. The problem is likely what comes after \# (i.e. the crucial part), since :silent !okular --unique %:p:r.pdf works as expected.


I'm using Windows 7 and Okular, although I also tried SumatraPDF before, with exactly the same result. Frankly, I don't think the problem is with the viewer. Here's what I have in my tex.vim



let g:Tex_DefaultTargetFormat='pdf'
let g:Tex_CompileRule_dvi='latex -synctex=1 --interaction=nonstopmode --src-specials $*'
let g:Tex_CompileRule_pdf='pdflatex -synctex=1 -interaction=nonstopmode $*'
let g:Tex_ViewRule_pdf='okular'




Aucun commentaire:

Enregistrer un commentaire