How to make vim Latex Suite recognize an "unknown package" error?

I use Vim Latex Suite and I like it. But there are some points in which he does not do what I want.

From the file .vim/compiler/tex.vim :

 " 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 \bb-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 does not say anything about missing packages. This can be seen when compiling a Tex file with \usepackage that is not on the system.

you can usually get an 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 is not supported, I get:

enter image description here

As you can see, nothing is said about the missing package, just a cryptic emergency stop

Another problem is that when an unknown parameter is passed to the package, Vim opens the .sty package .sty , which can be very annoying.

How to make vim recognize this error?

+7
source share
1 answer

I do not see anything wrong with the error you are getting. Remember that vim knows nothing about latex. All the messages you see is what the latex compiler pulls out (which, in turn, does not know about vim). Everything that vim-latex-suite does, displays the output neatly in the vim buffer / window for readability / correction.

Secondly, I think that you just see the last part of the error message in the Quickfix / log window, and if you scroll up, you should see the correct message. Here is an explanation of what you see and various compilation methods.

Non-stop mode

In this mode, pdflatex (or latex ) compiles without stopping for warnings / errors, which is useful because I really don't want to pause and press enter at every step. Judging by the error message, this is the mode in which you run it. The place where this mode is set is located in ~/.vim/ftplugin/tex.vim , in particular, the following line:

 let g:Tex_CompileRule_pdf = 'pdflatex -interaction nonstopmode $*' 

To demonstrate, here is a test case that I compiled

 \documentclass{article} \usepackage{notapackage} \begin{document} Hello world \end{document} 

The message I get:

enter image description here

At first it looks like what you have, but note that they are on lines 42-47 . Scrolling through a few lines, you will find:

enter image description here

In this mode, there is no way to stop it (why it called the mode without stopping!), And this is the behavior that you see if you started it from the terminal.

Interactive mode

In this mode, it pauses for each error and gives you the opportunity to fix (if possible). This is useful for large projects (for example, books running on pages with a large number of equations + floats), where the compilation time is longer and you prefer to pause for correction rather than recompile from the very beginning.

If you turn off the mode without stopping by setting

 let g:Tex_CompileRule_pdf = 'pdflatex $*' 

and then try to compile, vim will lead you to a terminal where you can enter a new name for the package at the prompt. Since this is a simple example, to visually see the changes after entering a new package, I entered palatino at the prompt. This should compile the PDF file and display "Hello world" in the Palatino font, and it really is! (Palatino is on the left, and CM is on the right by default).

enter image description hereenter image description here

However, I really do not recommend this mode if you, like me, just use latex for your school / math / cv. It will get upset quickly.

+5
source

All Articles