[TxMt] Latex Bundle grammar

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


On Sep 11, 2007, at 6:40 PM, Alain Matthes wrote:

>
> Le 11 sept. 07 à 23:57, Charilaos Skiadas a écrit :
>
>>
>> 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.
>
> Yes I understand this point of view
>>
>>> 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{}
>>>
>>>
>>
>> Ok, we need to include it then, it shouldn't be hard to do. Where  
>> would I find its documentation?
>
> Latex Companion version II

Well, I have that, does it offer an exhaustive list of all the  
commands in the package, and their syntax? Where would I look?

The other question also is, what would you want the grammar to do,  
more than what happens now? In your example below, the functions are  
matched and colored (albeit they all get the same color). What else  
would you like to see?

>>>
>> Just send them as an attached file, any format you choose will be  
>> fine, ideally make it clear what package each command is in,
>
> Ok i will make this for the next week
>
>> 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.
>
> Yes you are right but only two packages are very long (pstricks,  
> pgf/tikz) with a syntax very different and sometimes complicated.

Perhaps we could have those two as separate grammars, and include  
them via the include mechanism.

> look at this code of my next package and look at it with the actual
>  syntax. It's not very fine...
>
ouch!

In any case, I really think we need a dedicated grammar for package  
files, that would include the LaTeX grammar.

At some point I need to sit down and have a look at all this  
wonderful work you've been doing with pgf/tikz.

>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \define at cmdkey [TKZ] {Compass} {style}{}
> \define at cmdkey [TKZ] {Compass} {lw}{}
> \define at cmdkey [TKZ] {Compass} {color}{}
> \define at cmdkey [TKZ] {Compass} {delta}{}
> \define at boolkey[TKZ] {Compass} {clock}[true]{}
> \presetkeys    [TKZ] {Compass} {%
>                       style  = solid,%
>                       lw     = .4pt,%
>                       color  = black,%
>                       delta  = 10,%
>                       clock  = false}{}
>
> \newcommand*{\tkzCompass}[1][]{\tkz at Compass[#1]}%
> \def\tkz at Compass[#1](#2,#3){%
>     \setkeys[TKZ]{Compass}{#1}%
>     \pgfpointdiff{\pgfpointanchor{#2}{center}}
>                  {\pgfpointanchor{#3}{center}}
>     \tkz at ax=\pgf at x%
>     \tkz at ay=\pgf at y%
>     \pgfmathveclen{\pgf at x}{\pgf at y}
>     \edef\tkztempLen{\pgfmathresult}%
>     \pgfpointnormalised{\tkz at ax,\tkz at ay}
>     \pgfmathparse{atan(\pgf at y/\pgf at x)}
>     \edef\tkz at GammaD{\pgfmathresult}%
>     \ifTKZ at Compass@clock%
>     \pgfmathparse{\tkz at GammaD+180}\edef\tkz at GammaD{\pgfmathresult} \fi
>     \draw[shift ={(#2)},%
>           \cmdTKZ at Compass@style,%
>           \cmdTKZ at Compass@color,%
>           line width  = \cmdTKZ at Compass@lw]%
>      (\tkz at GammaD-\cmdTKZ at Compass@delta:\tkztempLen pt)%
>       arc (\tkz at GammaD-\cmdTKZ at Compass@delta:%
>            \tkz at GammaD+\cmdTKZ at Compass@delta:%
>            \tkztempLen pt);
> }
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> Regards Alain

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College







More information about the textmate mailing list