# [TxMt] Re: LaTeX: || should be verbatim, but not in tabular{|c|c|c}

Allan Odgaard mailinglist at textmate.org
Wed Jan 25 08:49:41 UTC 2012

On 24/01/2012, at 20.54, Dirk Günther wrote:

> I use the LaTeX grammar and I have defined my own shortverb command: | so that I can write |foo| and have everything enclosed in | and | treated the same as \verb|foo|. So I'd like to mark the contents between | and | as verbatim, but not in the tabular definition such as
>
> \begin{tabular}{|c|c|c|c}
>
> My attempt
>
> 		{	begin = '\|';
> 			beginCaptures = { 0 = { name = 'punctuation.definition.verb.latex'; }; };
> 			end = '\|';
> 			endCaptures = { 0 = { name = 'punctuation.definition.verb.latex'; }; };
> 			name = 'markup.raw.verb.latex';
> 		},
>
> works for requirement #1, but not for #2 (the tabular case). What should I do that |c| in \tabular{...} is not defined as verbatim?

The best approach is to have another rule that matches the tabular case.