vimtex not compiling on write

Created on 18 Jul 2017  Â·  14Comments  Â·  Source: lervag/vimtex

Hi, I am fairly new to linux and just started using vim. I installed vimtex and everything seems ok. However vimtex does not compile on :w.No error is produced or whatsoever. I have to write latexmk file.tex to compile and view the latex file.

My vimrc file:

call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()
let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
let g:vimtex_view_general_options_latexmk = '--unique'

Most helpful comment

Thanks, it is now easier to help!

First: Based on your steps, nothing should happen. You have to start compilation with \ll (or :VimtexCompile) before it starts to compile on write.

Second, since VimtexInfo does not work, the vimtex plugin is not properly installed or loaded. I am not sure exactly why that is, though. Note that the vimtex commands and mappings should only be available when editing LaTeX files. I propose that you have let g:tex_flavor = 'latex' in your vimrc file (as is suggested in the introductory parts of the vimtex documentation). That might solve your problem, since for some .tex files, Vim will by default use a different filetype then LaTeX.

All 14 comments

Any help please

Could you please be more specific? The issue template clearly states that you should try to explain your problem with the specific steps to reproduce. To repeat, please:

  1. State what you are doing (it is helpful if you can do it in a clear and concise manner).
  2. State what you expect will happen.
  3. State what you observe.

More background information also helps, e.g.:

  • Which distribution are you on?
  • Which version of Vim (or neovim)?

As a general suggestion: Please read the documentation. Most of what is needed to use vimtex is stated there. In particular, I think it is helpful to read the introduction sections.

Finally: Just to be certain that things should work properly, please provide the output from running the command :VimtexInfo (or the mapping \li).

  1. Trying to run this tex file

    \documentclass{article}
    \begin{document}
    This is a test.
    \end{document}
    
  2. Expect on :w it will compile and display in pdf format

  3. Nothing happens

I did read some versions and installed latexmk, but still nothing is working.
However latemk a.tex does work and it gives me a dvi output.
I also read some of the previous issues but to no avail

Message After Installing vimtex

Updated. Elapsed time: 0.045052 sec.    
[=]                                     |~                                      
                                        |~                                      
- Finishing ... Done!                   |~                                      
- vimtex: Already installed
---------------------------------------------------------------

ubuntu 14.04
vim 7.4

Output after typing in vim :VimtexInfo

E492: Not an editor command: VimtexInfo  

Thanks, it is now easier to help!

First: Based on your steps, nothing should happen. You have to start compilation with \ll (or :VimtexCompile) before it starts to compile on write.

Second, since VimtexInfo does not work, the vimtex plugin is not properly installed or loaded. I am not sure exactly why that is, though. Note that the vimtex commands and mappings should only be available when editing LaTeX files. I propose that you have let g:tex_flavor = 'latex' in your vimrc file (as is suggested in the introductory parts of the vimtex documentation). That might solve your problem, since for some .tex files, Vim will by default use a different filetype then LaTeX.

By the way: I've updated your posts with proper formatting. It is easier to understand your text if you apply proper formatting.

Added let g:tex_flavor='latex'

Output after :VimtexInfo

vimtex project: ak
  base: ak.tex
  root: /home/ak
  tex: /home/ak/ak.tex
  out: 
  log: 
  aux: 
  fls: 
  document class: article
  compiler: latexmk
    backend: process
    output: /tmp/vmuN7mI/1
Error detected while processing function vimtex#misc#info..vimtex#echo#pprint..<SNR>39_pprint_dict..vimtex#echo#pprint..<SNR>39_pprint_list..vimtex#echo#pprint...<SNR>39_pprint_dict..vimtex#echo#pprint..<SNR>39_pprint_list:
line    6:
E706: Variable type mismatch for: l:value

However it does work

Any solution on how to get rid of that error

Ok, so this means that the plugin works except for the error message with :VimtexInfo? That is good!

Since I don't get that error message, I assume this must be partly fixed in a more recent version of Vim. However, I can sort of see why the error occurs, so I'll see if I can find an alternative way of writing the code that prevents the error.

What is the output of :version (the first two lines)?

Btw: When pasting output or code, please use three ` before and after the code block. After the first three, you can add a language code, such as tex for LaTeX code or vim for vimscript.

I think my last commit should fix this. Please update vimtex and try again.

It does work. Thank you very much

No problem :)

Den ons. 19. jul. 2017, 17.53 skrev mesneym notifications@github.com:

It does work. Thank you very much

—
You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
https://github.com/lervag/vimtex/issues/906#issuecomment-316431888, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA898tzhBSwAfKjRzn32vmv5BsZedL2vks5sPiaCgaJpZM4Obrca
.

I am seeing the same issue and am puzzled by the same terminology: how is this plugin supposed to be used for compilation? Is the compilation supposed to be triggered manually any time (or once and for all, or once at any new start-up of vim buffer)?

If the latter, it is not quite clear to me the concept of continuous compilation.

Things should basically be well explained in the docs, see in particular :help vimtex-compiler. However, I realize that it's a lot of text and if you are new to both LaTeX and Vim then it can be much to learn at once. Please open a new issue if you need more help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsbuffalo picture vsbuffalo  Â·  3Comments

LuxGiammi picture LuxGiammi  Â·  3Comments

siemdejong picture siemdejong  Â·  5Comments

zhuosongz picture zhuosongz  Â·  5Comments

thomasahle picture thomasahle  Â·  4Comments