[TxMt] Re: comments in LaTeX bundle, wrong with TeX grammar

Charilaos Skiadas cskiadas at gmail.com
Wed Jun 18 17:56:15 UTC 2008


On Jun 18, 2008, at 12:59 AM, Will Robertson wrote:

> On 18/06/2008, at 12:51 AM, Charilaos Skiadas wrote:
>
>>> - .sty files are claimed by the TeX grammar (LaTeX would be better)
>>
>> IIRC, sty files often don't look too good on the LaTeX syntax
>> coloring, but perhaps I am misremembering. Do you write sty files,
>> and in that case would you rather have LaTeX as the grammar for them?
>
> Tricky question. Neither is particularly appropriate, since they  
> are designed for user-level documents; there ought to be a "LaTeX  
> code" grammar to be used for .sty, .cls, and (more  
> importantly) .dtx files.
>
> The most glaring example need for this I could see is that in  
> neither the TeX nor LaTeX grammar should "@" count as a control  
> sequence letter, but it should in a LaTeX code grammar. E.g., a  
> control sequence like \@ifnextchar should be highlighted in  
> a .sty/.cls/.dtx file but not in a .tex or .ltx file unless between  
> \makeatletter...\makeatother.
>
> In other respects, a LaTeX code grammar should, roughly speaking,  
> be a superset of the TeX and LaTeX grammars. (If the LaTeX grammar  
> is a superset of the TeX grammar already, then the LaTeX grammar is  
> the right choice -- sorry, I haven't compared the two in any detail  
> yet!)

Correct, the LaTeX bundle inherits the TeX grammar. The reason they  
are different is to allow for things like ConTeXt.

> Since LaTeX package authoring is rather a niche audience, I'm not  
> at all surprised that this issue hasn't come up before and it's  
> certainly not essential to add all these sorts of features. Your  
> question above just needed a longer answer than "yes" or "no" :)

You are correct, there does need to be a separate grammar for code  
files, extending the LaTeX bundle. It's simply a question of who is  
going to write it. I personally don't write such files, so I never  
had any interest in doing something like that. I would be happy to  
help anyone who wants to undertake the task however.

And yeah, it sounds like it should be extending the LaTeX grammar.  
Any volunteers?

> Cheers,
> Will

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College







More information about the textmate mailing list