[TxMt] Latex Bundle grammar

Charilaos Skiadas cskiadas at gmail.com
Tue Sep 11 11:23:59 UTC 2007


On Sep 11, 2007, at 1:29 AM, Alain Matthes wrote:

>
> Le 11 sept. 07 à 03:11, Brad Miller a écrit :
>
>>
>> Then I don't understand very well why all the part about "lstlisting"
>>
>> "lstlisting" don't work with utf8 and why it is not possible to make
>> this work outside text.tex.latex ?
>> (perhaps it is not possible ?)
>> I suppose I am partially to blame for that, since I worked on the  
>> grammar early on, and I do a lot with lstlisting in my writing.   
>> Why is this a problem for you?
>>
>
> hello
>
> No you are not to blame  and I want to say that your work is fine  
> and it's a real pleasure to work with TexTMate on LaTeX. But I now  
> I've a little time to see what  there is in the grammar and to make  
> a theme for LaTeX.
>
> I know that "lstlisting" is sometimes very important for authors  
> but we can say the same for a lot of packages.
> My english is poor so perhaps my question is difficult to understand :
>
> I would to know how is managed the bundle :
>
> There parts like
>
> latex
> tex
> tex.math
>
> now if I want to create  an extension for that with
>
> grammar (keywords)  for pgf/tikz or
> calc,ifthen,xkeyval ( for those who make packages)% i'm not sure of  
> my english here !!
> pstricks etc...
>
> I would like to know if you have a method (project ??) and how to add
> grammar .
>
> I can make my personnal latex bundle but i would prefer to make  
> something useful for every one (it's possible!)
>
> Regards  Alain

Though I'm still not entirely sure what the question is, I'll try to  
answer it.

The LaTeX bundle contains the following grammars:

TeX
TeX Math
LaTeX
LaTeX Beamer
LaTex Memoir

1) The TeX grammar contains items that should be valid in any system  
based on TeX. (For instance a grammar for ConTeXt should probably be  
including this grammar.)
2) The TeX Math grammar contains commands that are used in math mode.  
It is included in other grammars whenever they have to enter math  
mode. Typically one would create just a repository rule in a grammar  
for something like that, instead of a brand new language, but we  
needed to be able to call this grammar from lots of other grammars,  
so we had to make it into a separate grammar.
3) The LaTeX grammar is the basic grammar. It includes the TeX  
grammar and adds all the LaTeX specific stuff. In particular, it adds  
the \[ ... \] and \( ... \) math modes, and hence needs direct access  
to the TeX Math bundle, which it includes at those points. (This is  
why we could not simply have TeX Math as a repository in the TeX  
grammar, because then the LaTeX grammar couldn't call it.)
4) For specialized document classes, at this point in time, we simply  
create a new grammar that includes the LaTeX grammar and adds its own  
specific stuff. (This might become simpler/better in TM 2.0).  
Examples of this are the Beamer and Memoir grammars.

5) For commands in particular packages, we typically would add those  
to the LaTeX grammar. Just make the additions you want to the grammar  
and send it to us, and we would add them. (Or consult with us on what  
changes you think are needed.). So for adding specific package  
commands, this is the option you should aim for.

6) For working on sty files however, ideally we would have a  
different grammar. This grammar would include the LaTeX grammar in  
it, and add all the stuff that package authors would need. So for a  
"package authors" grammar, this is the option you should aim for.

Hope this helps you get started, please feel free to ask more  
questions. The structure of the LaTeX bundle is admittedly not the  
simplest in the world, and the vastness and free structure of LaTeX  
is probably partly to blame.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College






More information about the textmate mailing list