Thread: [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 |
From: Srinath A. <sr...@ee...> - 2002-11-13 19:29:54
|
Hey Carl, vim-latex already provides the mechanism to do this... The way to do this will be to modify Tex_IgnoredWarnings to something like this: > " this is the list of patterns which will be ignored from the compiler ou= tput. > " This is a handy way of specifying which warnings/errors to ignore. This= is a > " list of patterns seperated by '=A1' > TexLet g:Tex_IgnoredWarnings =3D > =09\'Underfull=A1'. > =09\'Overfull=A1'. > =09\'specifier changed to=A1'. > =09\'You have requested=A1'. > =09\'Missing number, treated as zero.=A1'. > =09\'There were undefined references=A1'. > =09\'Citation %.%# undefined=A1' > > " the 'ignore level' of the 'efm'. A value of 4 says that the first 4 kin= ds of > " warnings in the list above will be ignored. Use the command TCLevel to = set a > " level dynamically. > TexLet g:Tex_IgnoreLevel =3D 7 By default, you can have g:Tex_IgnoreLevel set to 7. This will ignore all the citation reference missing and stuff. After you're doing doing math, you can do :TCLevel 4 which will begin showing you citation reference missing errors... See :help latex-suite-compiler for further details. Does that help? Srinath On Wed, 13 Nov 2002, Carl Mueller wrote: > 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 ha= s > 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, y= ou > work on the math first. When the article is ready, then you run bibtex a= nd > work on getting the citations right. One proposal was to automatically r= un > 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 re= ady. > > I guess Knuth recognized this situation. The latex program stops only fo= r > latex math errors. The others are recorded in the .log file, but the use= r > 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 a= ll > 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> > =09=09 } > l.11 There is a mistake here $2^{x$ > =09=09=09=09 . 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 th= e > position of the error. This feature is a part of emacs auctex, so I want= ed > to be sure I had it in auctex.vim. I hope that vim will not be second be= st > 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 mov= es > it to the correct line, and the correct position within the line. It doe= s > 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') =3D=3D 0 > =09edit # > =09redraw > =09call input("\nNo (More) Errors Found\n\nPress 'enter' to go on.") > else > =09let linenumber =3D matchstr(getline('.'), '\d\+') > =09let errorposition =3D col("$") - strlen(linenumber) - 4 > =09 "Put a space in the .log file so that you can see where you were, > =09 "and move on to the next latex error. > =09s/^/ / > =09write > =09split # > =09exe "normal " . linenumber . "G" . errorposition . "lzz\<C-W>wzz\<C-W>= w" > endif > endfunction > > ---------------- > > Best wishes, > Carl Mueller > > > ------------------------------------------------------- > This sf.net email is sponsored by: Are you worried about > your web server security? Click here for a FREE Thawte > Apache SSL Guide and answer your Apache SSL security > needs: http://www.gothawte.com/rd523.html > _______________________________________________ > Vim-latex-devel mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vim-latex-devel > > --=20 Srinath Avadhanula Nov 13 11:16am The goal of science is to build better mousetraps. The goal of nature is to build better mice. |