I'm using the Vim Latex Suite, and I love it. But there are some points in which it doesn't do what I want.
From the .vim/compiler/tex.vim
file:
" Depending on the 'ignore-level', the following kinds of messages are
" ignored. An ignore level of 3 for instance means that messages 1-3 will be
" ignored. By default, the ignore level is set to 4.
"
" 1. LaTeX Warning: Specifier 'h' changed to 't'.
" This errors occurs when TeX is not able to correctly place a floating
" object at a specified location, because of which it defaulted to the
" top of the page.
" 2. LaTeX Warning: Underfull box ...
" 3. LaTeX Warning: Overfull box ...
" both these warnings (very common) are due to \hbox settings not being
" satisfied nicely.
" 4. LaTeX Warning: You have requested ...,
" This warning occurs in slitex when using the xypic package.
" 5. Missing number error:
" Usually, when the name of an included eps file is spelled incorrectly,
" then the \b开发者_如何学Cb-error message is accompanied by a bunch of "missing
" number, treated as zero" error messages. This level ignores these
" warnings.
" NOTE: number 5 is actually a latex error, not a warning!
This list doesn't mention anything about missing packages. This can be noticed when compiling a Tex file that has a \usepackage
which isn't on the system.
normally one would get the error (when adding `\usepackage{notapackage}:
! LaTeX Error: File `notapackage.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
But in vim, since this type of error isn't supported, I get:
As you can see nothing is said about a missing package, just an cryptic emergency stop
Another problem is that when an unknown option is passed to a package, Vim opens up that packages .sty
file, which can be mighty irritating.
How do I make vim recognize this error?
I see nothing wrong with the error you are getting. Remember, that vim does not know anything about latex. All the messages that you see are what the latex
compiler spits out (which in turn, does not know about vim). All that the vim-latex-suite
does is display the output neatly in a vim buffer/window for easy reading/fixes.
Secondly, I think that you are just seeing the last part of the error message in the Quickfix/log window and if you scroll up, you should see the correct message. Here's an explanation of what you're seeing and the different modes of compilation.
Non-stop mode
In this mode pdflatex
(or latex
) compiles without stopping for warnings/errors, which is useful because I don't really want to pause and hit enter at each step. Judging by the error message you have, this is the mode you are running it in. The location where this mode is set is in ~/.vim/ftplugin/tex.vim
especially, the following line:
let g:Tex_CompileRule_pdf = 'pdflatex -interaction nonstopmode $*'
To demonstrate, here's a test example that I compiled
\documentclass{article}
\usepackage{notapackage}
\begin{document}
Hello world
\end{document}
The message I get is:
At first, it looks like what you have, but note that they're at lines 42-47
. Scrolling up a few lines, you'll find:
There is no way to halt it in this mode (that's why it's called nonstop mode!), and this is the behaviour you see if you ran it from the terminal.
Interactive mode
In this mode it pauses for each error and gives you a chance to correct it (if possible). This is useful in large projects (i.e. books running into pages with lots of equations + floats) where the compile time is longer and you'd rather pause to fix than recompile from the start.
If you turn off the nonstop mode by setting
let g:Tex_CompileRule_pdf = 'pdflatex $*'
and then try to compile, vim will take you to the terminal, where you can enter a new name for the package at the prompt. Since it is a simple example, to see the changes visually after entering a new package, I entered palatino
at the prompt. This should compile the PDF and display "Hello world" in Palatino font, and indeed it does! (Palatino is on the left and the default CM is on the right).
However, I really wouldn't recommend this mode if you, like me, are just using latex for your school/math/cv work. It'll quickly get frustrating.
精彩评论