Question

I used Vim LaTeX for six months with natbib and had no problems. But to use a new bib style file (i.e., rfs.bst) I started using harvard.sty, which gives me two minor problems:

(1) syntax highlighting is not complete; specifically for \citeasnoun, Vim only highlights the \cite portion. With another Vim plugin (Vim-plugin-R) I can update the syntax highlighting, but I can't figure out how to do this in Vim. I refreshed the databases in MikTex, but that didn't work.

(2) Vim LaTeX is automatically rerunning as necessary to get references correct -- the status window in Vim shows it going through several runs and the results are as desired -- but I still get this warning:

|| LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

How can I fix these? Thanks!

Was it helpful?

Solution

As for the syntax highlighting issue, you could try the following.

In your personal vim settings folder -- typically $HOME/.vim/ on Unix-based systems, or C:\Users\<yourname>\vimfiles (?) on Windows (probably the first entry shown in :set rtp?), create a directory (if there isn't one already) called after, and create a subdirectory of it called syntax, and in it create a file called tex.vim. So the file will be $HOME/.vim/after/syntax/tex.vim for Unix or C:\Users\<yourname>\vimfiles\after\syntax\tex.vim on Windows. (I hope a Windows user will confirm this, since I'm on Linux.)

In that file, put the following line:

syn match texRefZone '\\citeasnoun\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite

Then when you open a LaTeX file, \citeasnoun should be treated just like \cite as for Syntax Highlighting (...that's assuming you're using the default Syntax Highlighting rules for LaTeX files that came with vim 7.3 anyway....)

I think your other question is answered in the comments.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top