Luis A. Florit wrote:

* El 11/04/06 a las  9:58, Charles E Campbell Jr chamullaba:

Luis A. Florit wrote:

 I've always had some special highlighting for TeX
files. For example, I have the following syn for "$$":

hi dollars cterm=bold ctermfg=7 ctermbg=4 guifg=white guibg=blue
syn match dollars /\(\$\$\|\\\[\|\\\]\)/
...
But your (and Benji's) solution gives rise to another problem:
If I add containedin=ALL, or containedin=texDocZone, the "$$" are properly highlighted, but then 80% of the "}" in the manuscript are highlighted like errors, white over red (??!!).

Another problem that I have (but this one I always had) is that
the highlighting of the "$$" destroys the normal highlighting of the math zone, and errors appear inside the $$ ... $$. But I assume it has to do with the contained-contains stuff.

I tried, then:

hi dolares cterm=bold ctermfg=7 ctermbg=4 guifg=white guibg=blue
syn match dolares contained /\(\$\$\|\\\[\|\\\]\)/ containedin=ALL

but, still, the two problems persist: 80% of the "}" are marked
as errors, and the syntax inside the $$ ... $$ is destroyed.

Do you have a suggestion? I really don't get how this works.

Look into syntax/tex.vim. The $$ ... $$ is recognized as a texMathZoneY (normally). Now, your syntax item (dolares) occurs later, so it has priority; hence, the texMathZoneY
is bypassed by your extra syntax.

What you've wanted is to change the highlighting of $$. Currently, the texMathZoneY uses Delimiter for the highlighting of the $$s. Now, I haven't tested this, but one way to do this is
to overwrite the texMathZoneY:

 syn clear texMathZoneY
syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend [EMAIL PROTECTED]

This clears the texMathZoneY and then re-installs it. It does have a high priority (because its being done most recently) but I don't think that should be a problem. Now, change the "Delimiter" to "dolares". Include your dolares highlighting specification. Finally, put it into after/syntax/tex.vim (so that it gets loaded after
usual syntax/tex.vim highlighting for ft=tex files).  I think that'll do it!

Regards,
Chip Campbell

Reply via email to