LaTeX-Box-Team / LaTeX-Box

Lightweight Toolbox for LaTeX - New Official repository
http://www.vim.org/scripts/script.php?script_id=3109
GNU General Public License v3.0
396 stars 66 forks source link

Support of okular as the viewer? #256

Closed 5nizza closed 9 years ago

5nizza commented 9 years ago

Haven't found this in docs: Is it possible to preview pdf using okular rather than in evince?

(this is not an issue nor a feature request -- just a question).

ThomasFeher commented 9 years ago

Just tried setting let g:LatexBox_viewer = "okular" in my .vimrc and then calling :LatexView in a .tex file worked fine here (Linux).

5nizza commented 9 years ago

well, 1) it opens okular, but each call of \lv pops a new window, and 2) it does not scroll to the place of the vim cursor. but thanks! it is better than nothing!)

ThomasFeher commented 9 years ago

I have the same behaviour here, but actually never noticed it because okular re-reads the pdf as soon as it is changed. So there was no need to call :LatexView more than once.

Erotemic commented 8 years ago

This thread is a bit old, but I'll post an answer in case anyone else reads this.

It is possible to use let g:LatexBox_viewer = "okular --unique" to ensure that new windows are not created.

To move to a specific position in the file you can put the following code in your vimrc

function! SyncTexForward()
  let s:syncfile = LatexBox_GetOutputFile()
  let execstr = "silent !okular --unique ".s:syncfile."\\#src:".line(".").expand("%\:p").' &'
  exec execstr
endfunction
nnoremap <Localleader>ls :call SyncTexForward()<CR>

The above code is courtesy of https://www.reddit.com/r/vimplugins/comments/32t0xc/forward_search_with_latexbox/