[TxMt] Latex Bundle grammar

Alain Matthes alain.matthes at mac.com
Tue Sep 11 22:40:35 UTC 2007


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

>>
> 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.

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


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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


More information about the textmate mailing list