[TxMt] LaTeX Language Grammar and sub/superscripts

Mike Miller mightymiller19 at gmail.com
Tue Jul 18 20:33:06 UTC 2006


I am attempting to modify the LaTeX Language Grammar so that I may  
style superscripts and subscripts distinctly.  I tried to add the  
following:
{   name = 'constant.superscript.latex';
     match = '\^(\w{1}|\{.*?\}|\\\w*)';
     captures = { 1 = { name = 'meta.supersript.latex'; }; };	
},
{   name = 'constant.subscript.latex';
     match = '_(\w{1}|\{.*?\}|\\\w*)';
     captures = { 1 = { name = 'meta.subscript.latex'; }; };
},

However, when I invoke the "show scope" command in the TextMate  
bundle, neither of these scopes will appear.  (For example, if I type  
"Suppose that $\{x_n\}$ is a sequence..." and put the caret after the  
underscore, neither "constant.subscript.latex" nor  
"meta.subscript.latex" appears in the show scope tooltip.)

I am new to regular expressions, but if I do a find and replace with  
those expressions, they do seem to find all occurrences of subscripts  
and superscripts.  I think I probably don't understand the LaTeX  
language grammar, since I have trouble understanding even the  
shortest of grammars!

Also, are my naming conventions even close to correct?

For reference, I'm using TextMate 1.5.2 (r1180) and revision 4405 of  
the LaTeX bundle from the repository.

Thanks for your help,
Mike Miller



More information about the textmate mailing list