xuhdev / vim-latex-live-preview

A Vim Plugin for Lively Previewing LaTeX PDF Output
https://www.topbug.net/blog/2013/06/13/live-preview-of-latex-in-vim/
GNU General Public License v3.0
834 stars 74 forks source link

Evince is sometimes unable to open .pdf file using :LLPStartPreview after closing and reopening .tex file #115

Closed adi-joshi closed 3 years ago

adi-joshi commented 3 years ago

Expected behavior

Using :LLPStartPreview after opening a file should open the .pdf document with evince without any problem

Actual behavior

Evince sometimes throws the following error:

Unable to open document "file:///tmp/vim-latex-live-preview-1234abcd/path/to/file.pdf".

File type empty document (application/x-zerosize) is not supported

I can confirm that the file has been compiled, as I can open it with both

evince /tmp/vim-latex-live-preview-1234abcd/path/to/file.pdf
evince file:///tmp/vim-latex-live-preview-1234abcd/path/to/file.pdf

Evince is able to sometimes open the file, but this only occurs after I try to close and open the file in different ways a few times (eg. using some combination of the commands :w, :q and :q!). I am unable to consistently replicate when evince will successfully open the file, and when it will throw an error.

Steps to reproduce

Tell us how it occurs

  1. Make any simple .tex file. The following is file I made:
    
    \documentclass{article}

\begin{document}

Hi

\end{document}

2. Close the file using ```:wq```
3. Open the file again.
4. Use the command ```:LLPStartPreview```. Evince throws the following error on my computer:

Unable to open document "file:///tmp/vim-latex-live-preview-1234abcd/path/to/file.pdf".

File type empty document (application/x-zerosize) is not supported


## System configuration

- **Vim version**:

```bash
# output of `vim --version`

Here is my vim version info:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)
Included patches: 1-2269
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl               -farsi             -mouse_sysmouse    -tag_any_white
+arabic            +file_in_path      +mouse_urxvt       -tcl
+autocmd           +find_in_path      +mouse_xterm       +termguicolors
+autochdir         +float             +multi_byte        +terminal
-autoservername    +folding           +multi_lang        +terminfo
-balloon_eval      -footer            -mzscheme          +termresponse
+balloon_eval_term +fork()            +netbeans_intg     +textobjects
-browse            +gettext           +num64             +textprop
++builtin_terms    -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     -perl              -toolbar
+cindent           +job               +persistent_undo   +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           -python            +visual
+cmdline_info      +libcall           +python3           +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
+cscope            +localmap          -ruby              +wildmenu
+cursorbind        -lua               +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con        +mksession         +smartindent       -X11
+diff              +modify_fname      +sound             -xfontset
+digraphs          +mouse             +spell             -xim
-dnd               -mouseshape        +startuptime       -xpm
-ebcdic            +mouse_dec         +statusline        -xsmp
+emacs_tags        +mouse_gpm         -sun_workshop      -xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          +mouse_netterm     +tag_binary        
+extra_search      +mouse_sgr         -tag_old_static
--More--

Here is my vimrc, regarding vim-latex-live-preview

call vundle#begin()
Plugin 'xuhdev/vim-latex-live-preview'
call vundle#end()

autocmd Filetype tex setl updatetime=1
let g:livepreview_previewer = 'evince'
adi-joshi commented 3 years ago

I found what was causing the problem. I thought the updatetime parameter's value was in seconds instead of milliseconds. I can just change the value of updatetime to a bigger value (I used autocmd Filetype tex setl updatetime=1000 for updating every second) and it seems to work flawlessly.

Sorry for the trouble.