I just learned about LaTeX-Suite for vim and have a hard time setting up a compilation rule that invokes make to process my custom Makefile. The relevant section in my .vimrc reads

" vim-latex-suite setup:
filetype plugin on
filetype indent on
let g:tex_flavor='latex'

and .vim/ftplugin/tex.vim contains

" this is mostly a matter of taste. but LaTeX looks good with just a bit
" of indentation.
set sw=2
" TIP: if you write your \label's as \label{fig:something}, then if you
" type in \ref{fig: and press <C-n> you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:

" Compilation rules:
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_CompileRule_pdf = 'make $*.pdf'

If I omit the let g:Tex_DefaultTargetFormat = 'pdf'-line, \ll will build using latex, so the DefaultTargetFormat is treated correctly. But I can write into the CompileRule whatever I want, it will always produce the GNU make error make: *** No rule to make target 'pdf'.

The FAQ tells me to make sure, that :set makeprg? shows the same value as :set Tex_CompileRule_dvi, but it shows makeprg=make "pdf" instead. So LaTeX-Suite seems to be executing make "pdf", ignoring my compilation rule entirely.

I tried set makeprg=make\ %:r.pdf, but it does not even change the output of :set makeprg?, leaving me with the very same error.

1 Answer 1


This sounds like the expected behaviour due to g:Tex_UseMakefile taking its default value of 1. This leads vim-latex to override any Tex_CompileRule_<fmt> if a makefile is found, and to issue g:Tex_DefaultTargetFormat as the target to make, hence you're seeing make "pdf".

With let g:Tex_UseMakefile="0", the appropriate compile rule (which can still be a call to make) is followed even if a makefile is found.

Depending on the compilation rule it might be possible to configure within vim-latex using g:Tex_FormatDependency_<fmt> to indicate multiple compile rules and then take advantage of e.g. automatic multiple compilations to try and get cross-references right from a single \ll compilation call.

  • Thank you for that incredibly polite RTFM. In fact I recognized g:Tex_UseMakefile, but missed its default behaviour. Using g:Tex_FormatDependency_<fmt> is not an option because I have a lot of additional scripts being executed (mainly plotting).
    – staxyz
    Commented Jan 31, 2022 at 19:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .