Wednesday, August 29, 2007

Fixing LaTeX-Suite's jump to error feature.

LaTeX-Suite's jump to error feature doesn't always work correctly. The following is a fix proposed by Martin Sander on the vim-latex-dev mailing list.

The key observation is that passing the option -file-line-error-style to latex formats the output in a parser-friendly manner. So add the following to your .vimrc file.
let g:Tex_CompileRule_dvi = 'latex -interaction=nonstopmode -file-line-error-style $*'
And the following line needs to be added (at the appropriate place; see the patch below for context) to the tex.vim script of the LaTeX-Suite Package.
setlocal efm+=%E%f:%l:\ %m
Here is Martin's patch.
--- /usr/share/vim/addons/compiler/tex.vim      2007-01-29
13:39:58.000000000 +0100
+++ /home/lennox/.vim/compiler/tex.vim 2007-06-14 23:33:33.000000000
+0200
@@ -202,6 +202,7 @@ function! SetLatexEfm()

setlocal efm+=%E!\ LaTeX\ %trror:\ %m
setlocal efm+=%E!\ %m
+ setlocal efm+=%E%f:%l:\ %m

setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d