[SVN] LaTeX syntax coloring problem, new to b9 I think

Charilaos Skiadas skiadas at math.uchicago.edu
Thu May 19 05:41:30 UTC 2005


On May 19, 2005, at 12:20 AM, Allan Odgaard wrote:

> On May 19, 2005, at 7:00, Charilaos Skiadas wrote:
>
>> \footnote{We have used here that 
>> $\gcd\left(\delf{g}{x},\delf{g}{y}\right)=1$, which follows from the 
>> assumption that $Z$ is non-singular.}
>>
>> It seems the first $ gets overlooked, and the text "$, which follows 
>> from..." is considered string.latex.equation.linemath.$
>
> Yes, this is the nested brackets problem. When I add the proper stack 
> handling we'll just change all rules to include text.latex inside 
> brackets.

Looking forward to it.

>> On a related note, it seems the syntax as is does not understand 
>> generic commands with multiple arguments, like "\delf{g}{x}" above 
>> (user-defined). Is that just an oversight, or something inherently 
>> difficult to achieve?
>
> Probably both ;) starting with beta 9 it can be done with something 
> like this though:
>
> {   begin = "\\\\[A-Za-z]\\w*(?=\\{)"; end = "(?<=\\})";
>     patterns = (
>         { begin = "\\{"; end = "\\}"; }
>     );
> },

I tried the following:

       {   name = "declaration.function-with-arg.latex";
             // first match “\foo{arg}”
             begin = "\\\\[A-Za-z]\\w*(?=\\{)"; end = "(?<\\})";
             captures = { 1 = { name = 
"keyword.function.with-arg.latex.general"; }; };
             patterns = (
                 { begin = "\\{"; end="\\}"; },
                 { match = "\\{[^{}\\n]*(?R)?[^{}\\n]*\\}"; name = 
"entity.parameter.function.variable"; },
                 { match = "[^{}\\n]+"; name = 
"entity.parameter.function.variable"; }
             );
         },

i.e. added the       { begin = "\\{"; end="\\}"; },
and changed
            begin = "(\\\\[A-Za-z]\\w*)\\{"; end = "\\}";
to
            begin = "\\\\[A-Za-z]\\w*(?=\\{)"; end = "(?<\\})";
and also tried
            begin = "(\\\\[A-Za-z]\\w*)(?=\\{)"; end = "(?<\\})";

none of these worked. In fact, it seems that the first time this was to 
be used, it captured everything. Any ideas?

Haris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2080 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate-dev/attachments/20050519/76923fdd/attachment.bin>


More information about the textmate-dev mailing list