[TxMt] Pimping the LaTeX grammar - trying to, at least
Charilaos Skiadas
cskiadas at uchicago.edu
Sat Mar 25 18:07:42 UTC 2006
On Mar 25, 2006, at 11:26 AM, Daniel Käsmayr wrote:
> 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.
Can you be more specific *exactly* what you want marked up, and how?
> 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.
What functionality are you losing? Where exactly in the file are you
placing this set of instructions? The order of things of course matters.
> 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'; },
> );
> };
> };
This pattern you added is trying to match only within the first
capture, which in our case is something like "\section". I would
change the number in the captures from 1 to 0. That might work.
> but somehow this does not work. Any ideas what needs to be changed?
>
> thanx,
>
> Daniel
Haris
More information about the textmate
mailing list