problems with highlighting

1 view
Skip to first unread message

Michael Goerz

unread,
May 16, 2008, 10:10:00 PM5/16/08
to vim...@googlegroups.com
Hi,

in order to add some special highlighting for tex files, I created a
file ~/.vim/after/syntax.tex, that contains the following two lines:

syntax match texSectionTitle "\\section{[^}]}"
highlight texSectionTitle term=bold ctermfg=Red guifg=#80a0ff gui=bold

As far as I understand the docs, this should create some highlighting of
a section title. However, nothing happens. The section title's
highlighting is unchanged from what was defined in the global tex.vim.
Any suggestions on how do get this right? If I choose other pattern, it
doesn't work either. Executing ':highlight' shows that the definition of
texSectionTitle has been loaded. Any help would be greatly appreciated.

Thanks,
Michael

bill lam

unread,
May 16, 2008, 11:27:55 PM5/16/08
to vim...@googlegroups.com
Michael Goerz wrote:
> syntax match texSectionTitle "\\section{[^}]}"

did you try \\\\section instead of \\section ? perl -pie needed this pattern
last time that I worked on latex files.

HTH


Michael Goerz

unread,
May 17, 2008, 6:01:12 AM5/17/08
to vim...@googlegroups.com
Yeah, I tried that, too. No effect. It doesn't seem like the pattern is
the problem. Even if I put in a simple word, that word doesn't change
highlighting. There's just no effect at all.

Michael

Michael Goerz

unread,
May 17, 2008, 8:00:49 AM5/17/08
to vim...@googlegroups.com, drc...@campbellfamily.biz
Michael Goerz wrote, on 05/17/2008 04:10 AM:
> Hi,
>
> in order to add some special highlighting for tex files, I created a
> file ~/.vim/after/syntax.tex, that contains the following two lines:
>
> syntax match texSectionTitle "\\section{[^}]}"
> highlight texSectionTitle term=bold ctermfg=Red guifg=#80a0ff gui=bold
>
> As far as I understand the docs, this should create some highlighting of
> a section title. However, nothing happens. The section title's
> highlighting is unchanged from what was defined in the global tex.vim.
> Any suggestions on how do get this right? If I choose other patterns, it
> doesn't work either. Executing ':highlight' shows that the definition of
> texSectionTitle has been loaded. Any help would be greatly appreciated.
I got it right now. The main problem was that I had to add my new
groupname to the "contains" argument of the texDocZone region that's
defined in the standard tex highlighting file. My modified syntax file
is in the attachment. I put it in ~/.vim/syntax.

Cheers,
Michael

tex.vim

Peter Hodge

unread,
May 17, 2008, 8:49:26 PM5/17/08
to vim...@googlegroups.com

--- Michael Goerz <go...@physik.fu-berlin.de> wrote:

>
> Hi,
>
> in order to add some special highlighting for tex files, I created a
> file ~/.vim/after/syntax.tex, that contains the following two lines:

Hi,

Doesn't the syntax file need to be named ~/.vim/after/syntax/tex.vim?

regards,
Peter

>
> syntax match texSectionTitle "\\section{[^}]}"
> highlight texSectionTitle term=bold ctermfg=Red guifg=#80a0ff gui=bold
>
> As far as I understand the docs, this should create some highlighting of
> a section title. However, nothing happens. The section title's
> highlighting is unchanged from what was defined in the global tex.vim.
> Any suggestions on how do get this right? If I choose other pattern, it
> doesn't work either. Executing ':highlight' shows that the definition of
> texSectionTitle has been loaded. Any help would be greatly appreciated.
>
> Thanks,
> Michael
>
> >
>

Get the name you always wanted with the new y7mail email address.
www.yahoo7.com.au/y7mail


Michael Goerz

unread,
May 19, 2008, 8:53:50 PM5/19/08
to vim...@googlegroups.com
I just noticed a problem with the file. It seems that using the syntax
file has a very bizarre effect concerning spell checking. Normal text is
no longer spell checked, except parts that are in parentheses! Does
anyone have an explanation for this behavior?

Thanks,
Michael

Reply all
Reply to author
Forward
0 new messages