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

`Failed to compile` when `:LLPStartPreview` is called #119

Open icedwater opened 2 years ago

icedwater commented 2 years ago

Expected behavior

evince should launch with the preview of the current PDF when :LLPStartPreview is run.

Actual behavior

evince does not run. Instead, "Failed to compile" appears in the status line of vim.

Steps to reproduce

  1. Manually install the plugin into ~/.vim/plugin/. (evince / pdflatex are both installed.)
  2. Edit anyfile.tex.
  3. Run :LLPStartPreview.

System configuration

# output of `vim --version`
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 20 2021 11:42:42)
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    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-RjZCd2/vim-8.1.2269=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lcanberra -lacl -lattr -lgpm -ldl     -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm

Ubuntu 20.04 LTS

xuhdev commented 2 years ago

Does your tex file compile on command line?

icedwater commented 2 years ago

Yes, it does. This is all of it, and yes, there is a warning about 20pt:

\documentclass[20pt]{article}

%\usepackage{parskip}

\title{Testing}
\author{@icedwater}
\date{\today}

\begin{document}

\maketitle

\par{paragraph 1
continues here}

\par{this block is paragraph 2}

\par{and paragraph 3}

\end{document}
icedwater commented 2 years ago

For what it's worth, I tried to reproduce the bug on vim in Ubuntu 18.04 / WSL.

This time the live preview works fine. Maybe something changed in 20.04's bundled vim.

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 13 2020 15:49:09)
Included patches: 1-1453
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               -perl              +vertsplit
-clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               -ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              +mouse_gpm         +syntax
+ex_extra          -mouse_jsbterm     +tag_binary
+extra_search      +mouse_netterm     +tag_old_static
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-EfP9JP/vim-8.0.1453=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl     -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm
xuhdev commented 2 years ago

there is a warning about 20pt

Did you have a nonzero exit code?

icedwater commented 2 years ago

there is a warning about 20pt

Did you have a nonzero exit code?

Nope, echo $? returns 0.

~/projects/vimlatex$ pdflatex example
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./example.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))

LaTeX Warning: Unused global option(s):
    [20pt].

(./example.aux) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
(./example.aux) )</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/
cmr10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.p
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr17.pfb>
Output written on example.pdf (1 page, 32751 bytes).
Transcript written on example.log.
~/projects/vimlatex$ echo $?
0
Abdulee commented 2 years ago

I was having the same issue however I managed to fix it by installing texlive-latex-extra package... However, since your outlook is compiled correctly with pdflatex I am not sure if it will work for you

GSentientWolf commented 2 years ago

I don't know if this might be helpful. When using the plugin with graphicx package and I declare \graphicspath{ {.figures/}{../../requiredimages} } (Using relative paths). vim-latex-live-preview always exits with an error and indicates 'Failure to compile'. I checked my temporary folder and the pdf file is compiled but with the image placeholders. I stopped using relative paths for my image folders and always declare full paths and it seems I stop having this issue. When I compile my file directly using \graphicspath with relative paths, I don't have this issue. I tried to find a way to get debug messages when using LLPStartPreview but I couldn't find a way to set them up.

icedwater commented 2 years ago

I don't know if this might be helpful. When using the plugin with graphicx package and I declare \graphicspath{ {.figures/}{../../requiredimages} } (Using relative paths). vim-latex-live-preview always exits with an error and indicates 'Failure to compile'. I checked my temporary folder and the pdf file is compiled but with the image placeholders. I stopped using relative paths for my image folders and always declare full paths and it seems I stop having this issue. When I compile my file directly using \graphicspath with relative paths, I don't have this issue. I tried to find a way to get debug messages when using LLPStartPreview but I couldn't find a way to set them up.

Thanks for the tip. My example file didn't have any graphics in it, though. I'll keep this in mind in case I try this again with graphicx.

icedwater commented 2 years ago

The preview seems to work fine (as long as I'm not in insert mode) until I uncomment \usepackage{parskip}; it could just be that I haven't installed that package. A failure to compile in that case is to be expected.

In that case, I suggest the error message could be expanded a little, though I suppose if pdflatex doesn't expose any of its error codes, it would be difficult to do so.

pedrommaiaa commented 2 years ago

I was having this problem, but it turned out that I had some Latex errors in the actual document and that's why it wasn't compiling. Try opening and compiling the document with TeXShop or something similar and check to see if there are any errors.

ghost commented 2 years ago

I know this is an old ticket, but for the future:

I had the same error, but when I added a missing bracket it was able to compile.