[TxMt] Pimping the LaTeX grammar - trying to, at least

Daniel Käsmayr 321r7db02 at sneakemail.com
Sat Mar 25 17:26:18 UTC 2006


Dear folks,

I would like to get some language grammar markup to the different  
levels of headings in my Latex stuff - and thus I am trying to mess  
with the grammar file. I have added rules like:

		{	name = 'meta.section.level0.latex';
			begin = '((\\(?:part))(\*?)(?:(\[)[^\[]*?(\]))??(\{))';
			end = '(\})';
		},

which seem to work - but I am losing the functionality of the  
"regular" Latex grammar. So I am trying to nest the recognition  
somehow, resulting in:

		{	name = 'meta.section.latex';
			comment = 'this works OK with all kinds of crazy stuff as long as  
section is one line';
			begin = '((\\(?:(?:sub)*section|chapter|paragraph|part|addpart| 
addchap|addsec|minisec))(\*?)(?:(\[)[^\[]*?(\]))??(\{))';
			end = '(\})';
			captures = { 1 =
				{	name = 'support.function.section.latex';
					patterns = (
						{	include = '#levelA'; },
					);
				};
			};
			patterns = ( { include = 'source.tex'; } );
			contentName = 'entity.name.section';
			repository =
			{	levelA =
				{	name = 'meta.section.level0.latex';
					match = '((\\(section))(\*?)(?:(\[)[^\[]*?(\]))??(\{))';
				};
			};
		},

but somehow this does not work. Any ideas what needs to be changed?

thanx,

Daniel



More information about the textmate mailing list