syntax include syntax/tex.vim
syn region displaymaths matchgroup=mkdMaths start = "\\\\\[" end="\\\\\]" contains=@texMathZoneGroup
syn region inlinemaths matchgroup=mkdMaths start = "\\\\(" end="\\\\)" contains=@texMathZoneGroup
hi def link mkdMaths SpecialComment
The vim documentation (:help syn-include
) actually states this quite clearly (although could perhaps do with an example):
If top-level syntax items in the included syntax file are to be
contained within a region in the including syntax, you can use the
":syntax include" command:
n:sy[ntax] include [@{grouplist-name}] {file-name}
If you want to include a specific top-level syntax item 'foo' from the included syntax file, you need to have contains=@foo
in the syn region
command.
All syntax items declared in the included file will have the
"contained" flag added. In addition, if a group list is specified,
all top-level syntax items in the included file will be added to
that list.
So the @tex
grouplist-name in my question didn't need to be specified. If I were to have larger regions of TeX in my documents though, this would need specifying as it gives access to the namespace of the included syntax file, such that contains=@tex
will highlight the entire region according to all of the rules of the included syntax file.