For clarity, itβs best to give each syntax register a custom name, and then associate it with a standard color group. I renamed your original redTeX region.
You need to define a second innerBrace region that defines the curly braces you want to ignore, and mark this region as transparent. Then redTeX must be marked to contain a transparent area that it will ignore.
syn region innerBrace start=+{+ end=+}+ transparent contains=redTeX syn region redTeX start=+{\\color{red}+ end=+}+ contains=innerBrace hi link redTeX WarningMsg
Note that in this case there is an added subtlety that matches redTeX as innerBrace . I fixed this by marking innerBrace as containing redTeX .
Hope this makes sense!
source share