On Mon, Jul 31, 2006 at 11:47:33AM +1000, Brett Calcott wrote:
> Hi,
>
> I want to add some extra syntax highlighting to my latex documents. I
> am writing a thesis, so I have separate files for each chapter.
>
> For example, I add this in ~/vimfiles/extra/syntax/tex.vim
>
> syn region texFootnote matchgroup=texStatement start="\\footnote{"
> end="}"
> hi link texFootnote Special
>
> Now in my latex file let's say I have this:
>
> \chapter{Introduction}
> bla bla bla \footnote{see here for more bla}
>
> The highlighting does not work. But if I comment out the \chapter
> command then it does. So the syntax highlighting of \chapter is
> affecting whether or not my additional syntax works.
>
> I am sure there is something simple that I need to do to make this
> work, but the intricacies of the syntax highlighting system elude me.
> Can anyone tell me what the right move is here?
I think the simple answer (untested) is to add "containedin=ALL" to
your syntax definition.
:help syn-containedin
Another way to do it is to search for '\chapter' in the default suntax
file:
:e $VIMRUNTIME/syntax/tex.vim
/\\chapter
I think the \begin{chapter} declaration starts a texChapterZone, so
maybe you could use "containedin=texChapterZone" or (better if it works
that way) "containedin=texDocGroup". Proper use of clusters is a little
beyond what I know of syntax highlighting.
HTH --Benji Fisher