[TxMt] Latex Bundle grammar

Brad Miller bmiller at luther.edu
Tue Sep 11 17:27:43 UTC 2007


Alain,

Thanks for the good ideas!

So I think what you are saying is that it would be nice to conditionally
include some grammars as a part of the latex grammar depending on which
packages you are using.  This would have some very good benefits: 1.  It
would keep package grammars like lstlistings from making the plain latex
grammar overly long.
2.  This might have some speed benefits for editing as well.
3.  It would also make it easy for people to incrementally add new scopes to
the grammar that are specific to individual packages without having to
modify the plain latex grammar.

This is great.  But as far as I know this is not possible in the current
version of TM.

Today we have to do things the other way around  For example I would have to
make an lstlistings grammar that included latex and tex.  But this is not
good at all since it only would allow me to have the specialized grammar for
one particular package.

So, until we get to TM 2.0 or later, or someone tells us how to
conditionally include grammars, we have to keep adding to the latex grammar
for each package that we want to have scoped.

Brad
-- 
Brad Miller
Assistant Professor, Computer Science
Luther College

On 9/11/07, Alain Matthes <alain.matthes at mac.com> wrote:
>
>
> Le 11 sept. 07 à 13:23, Charilaos Skiadas a écrit :
>
> > 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.)
>
> Firstly, Thanks for this answer. You understand exactly my problem
>
> I need some precisions about patterns and include:
>
> include = 'text.tex'; i understand this one but the next are not very
> clear for me
>
>   include = '$self';
>
> include = '$base';
>
> > 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.
>
> Perhaps I need to wait for TM 2 !
>
> Questions about Beamer
>
> 1) In text.tex.latex we have : firstLineMatch = '^\\documentclass(?!.*
> \{beamer\})';
>
> and in 'text.tex.latex.beamer : firstLineMatch = '^\\documentclass(\
> [.*\])?\{beamer\}';
> >
> > 5) For commands in particular packages, we typically would add
> > those to the LaTeX grammar.
>
> I'm not sure that's a good way because i don't use listings (pb with
> utf8) and I prefer pgf/tikz to pstricks.
> I would like to know if it's possible to enable or disable some
> parts. I'm not sure but I think that's a big and long grammar is not
> good for the speed to match a long text. That is why , I made a
> remark about "listings" because it's not "pure" latex.
>
> There is now an excellent way for the preferences with a panel, we
> can imagine a panel for the grammar package to add :
> beamer, memoir, xcolor, listings, pstricks, tikz, amsmath etc...  and
> for the author : calc ifthen etex multido
>
> Or a file in the preferences
>
> > 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.
>
> for text.tex.latex
>
> I've make somme additions :
>
> {name = 'meta.preamble.latex';
> contentName = 'support.class.latex';
> begin = '((\\)(?:usepackage|documentclass|RequirePackage|
> usetikzlibrary))(?:(\[)([^\]]*)(\]))?(\{)';
>
> and some modifications
>
>                 {name = 'constant.numeric.math.latex';
>                 match = '((\+|-)?)(([0-9]*[\.][0-9]+)|[0-9]+)';
>
> because There is constant.numeric.math.tex and no
> onstant.numeric.math.latex and i want the sign + or - in the same
> color !
>
> for text.tex
>
> With keyword.control.tex, I've a problem with some terms like
> \if at tkz@visible or  \ifTKZ at tkzInit@NO . The symbol @ is a problem and
> in a package author there a lot of terms with @.
>
> I add name = 'keyword.operator.tex'
>
> with begingroup, endgroup, global def edef xdef gdef expandafter
> newbox newdimen newcount advance multiply divide etc...
>
> but i'm not sure like keyword.control.tex ( with if else fi) that's
> necessary to a classic user of TeX.
>
> 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
>
> A latex user must use \ifthenelse  \newboolean \setboolean \isodd
> \whiledo \equal \lengthtest all these macros are in Latex and not in
> tex.
>
> Important keywords in LaTex are newcommand, renewcommand, newcounter,
> setcounter, newlength, setlength, addtolength and some keywords tex
> are also necessary : advance multiply divide etc...
>
>   I'm sorry because a lot of ideas are not in a good order.
>
> Regards Alain
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070911/a1c3921a/attachment.html>


More information about the textmate mailing list