[Vim-latex-devel] running latex; further thoughts
Brought to you by:
srinathava,
tmaas
|
From: Carl M. <cm...@ma...> - 2002-11-13 14:56:16
|
I had some more thoughts about running latex.
1. As I have already said, on the first run, there are a lot of spurious
warnings of the kind "Reference `xxx' undefined" because the .aux file has
not yet been created.
2. Even if this problem is fixed, there will be a problem with undefined
citations (\cite{xxx}). If you are like me, when you write an article, you
work on the math first. When the article is ready, then you run bibtex and
work on getting the citations right. One proposal was to automatically run
bibtex if necessary. This would fail if the user has not yet updated his
bibtex file to include the most recent references. Probably, if he is
working on the math, he will not even have moved his bibtex file to the
current directory. He just wants to check for math errors, and would not
like it if vim-latex forced him to work on the references before he is ready.
I guess Knuth recognized this situation. The latex program stops only for
latex math errors. The others are recorded in the .log file, but the user
can ignore them if he wants.
So, maybe there should be 2 commands to run latex:
1. \ll would only check for latex math errors.
2. \LL would check for latex math errors, \ref{xx} errors, and \cite{xx}
errors. This would be the same as the current \ll command.
-------------
Another issue is that for math errors, the quickfix window doesn't show all
of the information in the .log file. For instance, for the line
There is a mistake here $2^{x$. Can you see it?
the quickfix window gives
test.tex|11 error| Missing } inserted.
while the log file gives
! Missing } inserted.
<inserted text>
}
l.11 There is a mistake here $2^{x$
. Can you see it?
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
which is much more informative, especially with the broken
line, which gives the position of the error.
-------------
EVEN MORE IMPORTANT!!, after running latex, the cursor is not moved to the
position of the error. This feature is a part of emacs auctex, so I wanted
to be sure I had it in auctex.vim. I hope that vim will not be second best
to emacs.
You might want to look at the following function. After latex is run,
calling the function splits the window, displays the relevant part of
the .log file, and moves the cursor to the position of the error. It moves
it to the correct line, and the correct position within the line. It does
that by looking at the broken line provided in the .log file. The length
of the first part of the broken line gives the position of the error
within the line. To keep track of which errors have been viewed, the
function makes an extra indent in the .log file.
--------------
function! s:NextTexError()
only
edit +1 %<.log
if search('^l\.\d') == 0
edit #
redraw
call input("\nNo (More) Errors Found\n\nPress 'enter' to go on.")
else
let linenumber = matchstr(getline('.'), '\d\+')
let errorposition = col("$") - strlen(linenumber) - 4
"Put a space in the .log file so that you can see where you were,
"and move on to the next latex error.
s/^/ /
write
split #
exe "normal " . linenumber . "G" . errorposition . "lzz\<C-W>wzz\<C-W>w"
endif
endfunction
----------------
Best wishes,
Carl Mueller
|