Vimtex: Compilation doesn't produce pdf

Created on 21 Jul 2016  路  9Comments  路  Source: lervag/vimtex

The problem is simple to explain: when I run \ll on a latex file, it produces a dvi output, but not pdf. Even with a tiny document test.tex like this:

\documentclass{article}
\begin{document}
This is a test.
\end{document}

Here is my minimized .vimrc:

filetype off 
set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after
set rtp+=~/.vim/bundle/Vundle.vim
set autoindent    " always set autoindenting on
call vundle#begin() 
Plugin 'VundleVim/Vundle.vim' 
Plugin 'lervag/vimtex'
call vundle#end() 
filetype plugin indent on 
let g:vimtex_view_method = 'zathura'
syntax on
set tw=90
set fo+=t

So if I start off with vim test.tex and then aim to compile it, I don't get a pdf file. For the purposes of providing a minimal example I removed my .latexmkrc file.

I'm using vim 7.4.1797 on Arch Linux.

Is it a vundle issue, do you think?

All 9 comments

I do not quite see why this is happening. Could you try the following minimal vimrc file instead?

set nocompatible
let &rtp = '~/.vim/bundle/vimtex,' . &rtp
let &rtp .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable

let g:vimtex_view_method = 'zathura'

I've removed the options you used as well here, which should not really matter, but no need to include them either. I'm curious: Why did you include the set runtimepath line?

In any case, with my minimal vimrc file and your minimal example, I think we have a good starting point for figuring things out.

So I copied your .vimrc to a file called .lvimrc, and started vim with

vim -N -u .lvimrc test.tex

followed with :w and \ll. Nope - still no pdf file! I even tried adding

let g:vimtex_latexmk_options = '-pdf  -verbose -file-line-error -synctex=1 -interaction=nonstopmode'

and then

let g:vimtex_latexmk_options = '-pdf -pdflatex="pdflatex --shell-escape %O %S" -verbose -file-line-error -synctex=1 -interaction=nonstopmode'

Neither worked. I simply cannot get a pdf file from with vimtex. On the other hand, in a shell, the command

latexmk -pdf test.tex

works fine.

This is very strange! Btw: The options you "even" use does NOT matter, stop trying that.

Let's investigate further:

  1. What version of latexmk do you have?
  2. Are you on the latest version of vimtex?
  3. Now please do: vim -Nu .lvimrc test.tex, then:

3.1 Start compilation with <leader>ll, then

3.2 Report the output of <leader>li (just copy the output by selecting it with the mouse)

3.3 Please also report the output of <leader>lo

In answer to your questions:

  1. My latexmk is version 4.4
  2. Yes, I ran :PluginUpdate, which is provided by vundle.
  3. I've removed the extra lines I put in so the .lvimrc file is exactly as you had it originally. The output of \li is

b:vimtex : test pid : 0 root : '/home/amca/Local/Temp' aux : '/home/amca/Local/Temp/test.aux' log : '/home/amca/Local/Temp/test.log' out : '/home/amca/Local/Temp/test.pdf' tex : '/home/amca/Local/Temp/test.tex' base : 'test.tex' viewer xwin_id : 0 class : 'Zathura' init : function('29') view : function('30') start : function('31') forward_search : function('32') latexmk_callback : function('33') latexmk_append_argument : function('34') xwin_exists : function('<SNR>50_xwin_exists') xwin_get_id : function('<SNR>50_xwin_get_id')

Notice that this compilation actually _did_ produce a pdf output! But for the life of me I can't get it to do it again. I've tried exiting and restarting vim several times, deleting all files except for test.tex, but I can't reproduce this behaviour.

  1. The output of \lo after another \ll is

vimtex: No output exists

which is standard behaviour (for me). By 3. above, I know that I _can_ get pdf, but I don't know what set of circumstances allowed this to happen. Might there be some temporary file somewhere which causes a conflict? Or is there a conflict with the surrounding system (tmux, in sakura)?

Ok, now we're getting closer. Let's refine the steps. Please perform the following steps in the following order and report all output here:

  1. Go to the tex file in a terminal, do latexmk -C to clean all generated files, including the pdf file.
  2. Open the tex file with vim -Nu .lvimrc test.tex
  3. Do \ll to start compilation --- Does it say "compilation started" or something similar now?
  4. Report output of \li

After \ll, the pid in the output of \li should NOT be zero. Are you certain you are not using any other options?

Also, now you are mentioning something about surrounding systems, e.g. tmux. Can you please do all of the above in a standard terminal, not inside a tmux buffer? I have not heard of sakura, so I do not know what that is.

I have no .latexmkrc files. Sakura is just a terminal emulator, but one I quite like.

So here is my workflow:

  1. Open up a new terminal emulator (in this case Terminator).
  2. Ran latexmk -C in the directory Local/Temp where the test.tex file lives.
  3. Enter vim -N -u .lvimrc Local/Temp/test.tex
  4. Ran \ll once in the file: with output Ran latex 2 time(s)
  5. \lo says as before vimtex: no output exists

Back in the terminal, the output of latexmk is

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2016/03/31>
Babel <3.9q> and hyphenation patterns for 43 language(s) loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo)) (./test.aux)
[1] (./test.aux) )
Output written on test.dvi (1 page, 288 bytes).
Transcript written on test.log.

Why would latexmk run with pdftex and yet not produce a pdf file? Or is latexmk somehow not picking up the parameters from vimtex?

Ah. Now, repeat steps 1-3, then:

  1. Do :map \ll, report output

I suspect that you actually have another LaTeX-plugin active, such that the \ll mapping does not fire vimtex functions. In particular, I think you might have LaTeX-Box or LaTeX-suite installed, perhaps on a system level. The reason: Running \ll with vimtex should _never_ output "Ran latex 2 time(s)".

Righto! The result of :map \ll was:

v  \ll          @<Plug>Tex_Compile
n  \ll          @<Plug>Tex_Compile

and do you know - you are absolutely right! I thought I have cleaned all the other LaTeX plugins out of my setup with vundle's :PluginClean command. But hidden away in ~/.vim/autoload was latexlivepreview.vim

A few minutes later...However, on clearing that file away, the problem above still persists. So I guess it must be a system file I need to remove.

A few minutes later still...And yes, it was in fact "latex-suite" which I'd installed with my system package manager (so not with a vim plugin manager). I removed it, and now, guess what - you'd hardly believe it, but 'tis true, upon my word:

IT WORKS!

Great! I'l take the liberty of closing the issue as resolved, then :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itsShnik picture itsShnik  路  5Comments

zhuosongz picture zhuosongz  路  5Comments

vanabel picture vanabel  路  6Comments

vsbuffalo picture vsbuffalo  路  3Comments

benutzer193 picture benutzer193  路  4Comments