[TxMt] Latex Bundle grammar

Charilaos Skiadas cskiadas at gmail.com
Tue Sep 11 21:57:11 UTC 2007


On Sep 11, 2007, at 4:17 PM, Alain Matthes wrote:

>
> Le 11 sept. 07 à 20:52, Charilaos Skiadas a écrit :
>>
>>> When you include text.tex in text.tex.latex, it's not a good  
>>> thing. there are good package to avoid the use of if etc...
>>> for example ifthen
>>
>> I am not following you here, why is it not a good thing?
>
> Sorry but here it'not very easy with my poor english language. In  
> fr.comp.text.tex we have a lot of debates about this.
>
> When you use Latex, it is preferable to avoid to use certain macros  
> of Tex (User' guide of Leslie Lamport page 204).

There is a difference between "something being preferable" and  
"something being invalid". If using TeX macros in LaTeX is *valid*,  
then our grammar should (try to) support them, regardless of whether  
it is recommended to do so or not. We are not trying to force users  
to use good code, we are merely trying to color their code as best as  
possible. That's why we are including the TeX grammar.

> The first answer is the syntax, the second, some macros TeX are  
> different with the same name in tex and latex.
>
> For example
> tex : newcount latex : \newcounter{}
> tex : newdimen latex  \newlength{}
>
> And latex provides some other macros \setcounter{}{} \setlength{}{}  
> \addtocounter{}{} \addtolength{}{} etc...
>
>
> With ifthen package you have \ifthenelse{test}{true code}{false code}
>
> you have \equal{}{} \lengthtest{}{} \boolean{} \newboolean{} and  
> \setboolean{}{} \isodd
> \whiledo{}{} \and \or \not \( \)
>
> I think it's important to have this package in the language grammar.

Ok, we need to include it then, it shouldn't be hard to do. Where  
would I find its documentation?
>
>>
>>> A latex user must use \ifthenelse  \newboolean \setboolean \isodd  
>>> \whiledo \equal \lengthtest all these macros are in Latex and not  
>>> in tex.
>>>
>> Oh these are not tex? Ok, we can fix those, is that the complete  
>> list?
>>
>
> I have begin a list of all the macros of TeX and LaTeX with the  
> most important packages, if you want I can send it to you

Please do.

>>> Important keywords in LaTex are newcommand, renewcommand,  
>>> newcounter, setcounter, newlength, setlength, addtolength and  
>>> some keywords tex are also necessary : advance multiply divide  
>>> etc...
>>>
>>
>> Basically I don't have a complete list of the commands in LaTeX,  
>> so we just need to keep on adding on our existing list.
>
> What is the best way to send the lists of macros (useful also for  
> the completion)

Just send them as an attached file, any format you choose will be  
fine, ideally make it clear what package each command is in, and  
whether a package automatically loads another package etc. We'll have  
to figure out some nice completion way since there are too many names  
probably, but we'll see.

> Regards Alain

Regarding a different grammar for each package: Most packages will  
really add a very small number of lines, i.e. they would have a list  
of commands and that's it. I'm not even sure we need a different rule  
for each package really in most cases.

All this only concerns the syntax, i.e. what words will be colored  
and how. It has nothing to do with completion and such. This would be  
a different mechanism, and it would indeed be nice for this mechanism  
to recognize which packages you include in the text, and only offer  
completion for commands that would be in those packages. Should not  
be too hard to do I don't think, if we have a list of commands and  
what packages they come from.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College






More information about the textmate mailing list