Q:

Vim match multiple argument Latex commands

I would like to know how to match a Latex command with multiple arguments in Vim. For example, I would like to match things of the form:
\command{SOME LATEX}{SOME LATEX}{SOME LATEX}

where the 'SOME LATEX' parts can have any normal latex highlighted inside. e.g.,
\command{\anothercommand{a}}{\anothercommand{b}}{\command{a}{b}{c}}

I am particularly interested in matching the \command{, each }{, and the final }. Is this possible in Vim, and if so, how?

A:

Here is the answer dealing with two argument cases, from which one can extend to higher arity cases. It deals with displaying \braket{a}{b} as <a|b> by using Vim's conceal functionality.
" This matches the '\braket' portion and displays it as '<'
syn match texStatement "\\braket\s*{\@=" conceal cchar=< contained containedin=@texmathzones

" This matches the first set of braces and hides the first, displaying the second as '|'.
syn region braketInner matchgroup=Delimiter start=+\%(\\braket\)\@<={+ end="}" contained transparent containedin=@texMathZones concealends cchar=|

" This matches the second set of braces and hides the first, displaying the second as '>'.
syn region braketInner matchgroup=Delimiter start=+\%(\\braket.*}\)\@<={+ end="}" contained transparent containedin=@texMathZones concealends cchar=>

Unfortunately, this means that braket commands cannot be contained in themselves; I cannot find a workaround for this.

