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

Daniel Käsmayr 321r7db02 at sneakemail.com
Sun Mar 26 01:15:12 UTC 2006


Haris,

As you are the "local LaTeX bundle god." Do you think functionality  
like what I am trying to do would be useful in the main bundle? I  
have been thinking about doing some bundle or snippets for language  
grammar extension specifically targeted to LaTeX, as this is my main  
concern these days (or better call it major distraction from actually  
*writing* my thesis).

What I am trying o accomplish is a much more detailed markup/ 
assignemnt of scopes for possible theme development. I believe it  
would be very useful to have that much more markup available,  
especially since I am using many packages, environments -- just  
getting some visual feedback would be nice. Or something where you  
are editing some lines somewhere and you are wondering which  
environment you are currently in, just press ctrl-shift-P and it  
prints "meta.environment.myverycoolenv" -- much better would be a  
very light color change in that environment. (I like to have my list  
environments colored… and possibly with different colors for itemize,  
enumerate etc.)

And these thoughts brought me to the point where I figured I could  
create that "detour" to include my custom language grammar before the  
LaTeX language grammar was read.

Examples for my changes are:
- recognize \vref and \prettyref as meta.label.reference
- markup the different \headings with  
support.function.section.XXX.latex with XXX being part, chapter,  
section etc.
- markup the acronym package
- markup the fixme package so the \fixme{} is easy to spot.

Many of these changes are not essential and mostly eye candy. But  
then: I like eye candy ;) Marking up commands that are not standard  
TeX or LaTeX does have other benefits - if you have a different color  
for recognized commands vs. words that start with \ - you kind of get  
spell checking built in for commands ;) i.e. "no special color? Not  
spelled correctly"

I am still not very comfortable with the whole language grammar  
setup, but I am learning… a bit awkward is also the naming convention  
- as I need a better understanding of the underlying logic in order  
to apply stuff to latex. But in the end - it is just markup and as  
long as there is some convention you can easily use the markup - but  
names are names and if i call something text.latex or humftibunm  
makes no difference to the machine -- just convenience for us users. ;)


A couple questions still bog my mind, though:
- Am I correct assuming that I can use a certain pattern just once?  
When I copy a rule from Latex.plist to my custom.plist - only the one  
encountered first gets to markup the text.
- Is there a way to markup a pattern with more than just one scopes?  
Like for \begin{mycustomlist} set something like  
meta.environment.list *and* meta.package.custom


Good night ;)

Dan


More information about the textmate mailing list