sponsor Vim development Vim logo Vim Book Ad

LaTeX error filter : Filters latex log file to get errors and warnings

 script karma  Rating 16/4, Downloaded by 814  Comments, bugs, improvements  Vim wiki

created by
Zhengdao Wang
 
script type
utility
 
description
The script is a utility that can be used to glean warning/error information from a latex compile. It will format the output into a format that is easy to read by VIM in the quickfix mode. This utility is useful for people who use VIM to edit LaTeX files, and don't use the VIM-Latex suite (the suite has already the quickfix capability). I don't use it because I think it is making things more complicated rather than simplifying it.

An alternative to using this script is to setup the errorformat variable for latex (see ":help errorformat-latex"), and use the vimlatex script available on this site too (to avoid the problem of broken numbers, and to help vim recognize filenames). But the messages are not as compact as those produced by this script.

Note 1: The filter needs awk to run.
Note 2: Even though the script is especially useful for people who don't use vim-latex, it is also useful for those who do -- It makes the messages more meaningful (e.g, 1 or 3, instead of 32 or 54, when there are actually only 3 messages on 54 lines).
 
install details
1. Save the script and make sure that it is in the executable path, and is executable.

2. Put these lines in your .vim/ftplugin/tex.vim file
"------------
set errorformat=%f:%l:%c:%m
function Latex()
    update
    let file=expand('%:t:r')
    let errors=system('latex --interaction nonstopmode '.file.' |latex-errorfilter')
    if errors==""
        echo 'LaTeX ok: No warning/error'
    else
        cexpr errors
    endif
endfunction

map <F4> :call Latex()<CR>
map <F6> :cprev<CR>
map <F7> :cnext<CR>
map <F8> :clist<CR>
"------------

3. In VIM, hit F4 to compile the latex file and show errors/warnings if any. F6 and F7 will show previous/next message, and F8 will list all messages.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
latex-errorfilter 0.2 2008-08-10 6.0 Zhengdao Wang column support.
ip used for rating: 3.14.253.221

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github