dinsdag 6 mei 2008

Multiple compilation using vim latex-suite and pdf

OOOooops... my first blog, my first crap message... good start. I write this down since I already forgot once... no will to research again... hopefully it helps someone as well...

I've been annoyed by the fact that (at least by default) the latex suite in vim does not perform multiple compilation when the target is set to pdf. It compiles just once and bye bye! using dvi it works nicely.

I repaired that once, but when I updated Ubuntu to Hardy the changes in the file were overwritten...

The solution I found was brute force:
Edit the file: compile.vim (which in Ubuntu is in the /usr/share/vim/addons/ftplugin/latex-suite/ directory).

This file contains (line 183):
if Tex_GetVarValue('Tex_MultipleCompileFormats') =~ '\<'.s:target.'\>'
call Tex_Debug("Tex_RunLaTeX: compiling file multiple times via Tex_CompileMultipleTimes", "comp")
call Tex_CompileMultipleTimes()
else
call Tex_Debug("Tex_RunLaTeX: compiling file once via Tex_CompileLatex", "comp")
call Tex_CompileLatex()
endif

I just commented the if statement and the whole else clause leaving to:
call Tex_Debug("Tex_RunLaTeX: compiling file multiple times via Tex_CompileMultipleTimes", "comp")
call Tex_CompileMultipleTimes()


and that's it. It does the trick. Surely there is a better way to do that... so if you know just let me know... by now I'll go on like that.

Have a nice day!
Ruben

1 opmerking:

Drew Frank zei

I just found a different solution that is a bit cleaner. Add a line to your .vimrc file with the following:

let g:Tex_MultipleCompileFormats='pdf,dvi'

Further details can be found at http://vim-latex.sourceforge.net/documentation/latex-suite/compiling-multiple.html

That said, I don't really know why you wouldn't want it enabled for all formats, so perhaps your solution is really better :).