# [TxMt] Re: Regarding the LaTeX bundle

Charilaos Skiadas skiadas at hanover.edu
Tue Sep 12 21:08:10 UTC 2006

On Sep 12, 2006, at 4:25 AM, Max Lein wrote:

> > On Sep 11, 2006, at 8:31 AM, Max Lein wrote:
> > This won't be very easy to do, we'll have to figure out the best way
> > to do it in terms of making sure the user stays up to date with
> newer
> > versions of the bundle. We could tell you how to edit the language
> > grammar to add these things, but that's not very easy to do and
> > results in the user having local modifications to the bundle which
> > might result in them not seeing any official changes that happen to
> > the grammar.
> Ok, I'm no expert, but I figure this is what many, many people want
> to do. Perhaps you could just list these commands in a separate
> file and include that file appropriately?

Not with the tools at our disposal, no. But see below for what you
can do now.

> > One thing that can be done now, is that you can create a new
> language
> > that basically has the extra commands, and then includes the latex
> > language, and you would be using that new language instead. I could
> > offer a template language and tell you what you need to edit where.
> > However, I would consider that only a temporary fix, because my
> > understanding is that the next major version of TextMate will have
> > tools that will make this customization process a lot easier/
> powerful.
> That would be great.

Very well, but use at your own risk. For this, open the Bundle Editor
(⌃⌥⌘B) and create a new language. Give it any name you like and
put it in any bundle you want. Then, in the big text area on the
left, place the following text:

{	scopeName = 'text.tex.latex.mylatex';
firstLineMatch = '^\\documentclass(?!.*\{beamer\})';
fileTypes = ( 'tex' );
foldingStartMarker = '\\begin\{.*\}|%.*$$fold$$\s*$'; foldingStopMarker = '\\end\{.*\}|%.*$$end$$\s*$';
patterns = (
{	name = 'support.function.myfunctions.latex';
match = '(\\)(my|commands|here)\b';
captures = { 1 = { name =
'punctuation.definition.function.latex'; }; };
},
{	include = 'text.tex.latex'; },
);
}

Set a key equivalent for this language. Make sure to press the button
that says "Test".
Now, set this as the language in one TeX file. This should be
respected in all other files.
Now, the commands:
\my
\commands
\here
will be recognized as support.function.myfunctions.latex
You can change that by changing the line with the name.
You can add commands to this list by adding them next to here in the
match line (well, you probably want to remov e those three first),
separated with a vertical line (|).
For instance:
match = '(\\)(this|list|of|commands|)\b'
would allow the use of the commands \this, \list, \of and \commands.

Adding environments is a bit more work.

> Well, we do what we are used to in the end ;-)
> I use align, because I got used to the way it, ahem, aligns formulas.

One of the things I hope to add to the bundle soon is the ability to
quickly change between equation styles. I.e. you are in an align
environment, and you press a button and it becomes a split
environment. And so forth.

> > Further, they have been designed so that you could execute them with
> > a selection, and then they would wrap around that selection.
> You thought of everything ;-)

We try to provide a service ;)

> > I would do: select the second part of the formula: press cmd-x, move
> > down until out of the environment, type eq (or the right shortcut)
> > followed by cmd-{ to generate a new equation environment, and then
> > press cmd-v.
> No sure, but that's what in principle the closing tag feature
> should be for ...

Well, the closing tag will just close the one above it. You also want
to open one. One could probably duplicate and modify the closing tag
command, so that it instead adds a \begin{env} too. So it would be a
"split environment" command. Might do that actually.
>
> > That is a good idea. Please suggest a list of specific howto topics.
> > I'll see if I can also do a screencast demonstrating a typical
> > complete workflow.
> Yes, this would complement written documentation nicely.
> > I guess that's why we have the outline at the very beginning, which
> > links to the subsequent sections. In the first draft of the help
> > there was such a thing, but then it was removed. We were trying to
> > keep the size of the LaTeX file a small as possible, so that users
> > could actually read the entire thing.
> I don't think this is something you can keep up with the increasing
> complexity. Thus, I don't think it's a good idea to constrain
> yourself in such a way.
>
Sorry,  I should have said: The size of the LaTeX Help file. I'm all
for creating other sources of assistance, like howtos and cheatsheets
and stuff. The help is supposed to be for reading by someone new to
the bundle, possibly even relatively new to LaTeX, who needs to get
started getting things set up and learning the basic commands.

> Instead, you could design one section to be read thoroughly and
> then let the rest be what it is: a manual.
>
> > How about a cheatsheet instead? A single page containing all the
> > necessary information, in the form of a pdf?
> Sounds like a good start. Refer to the appropriate sections in the
> Help as well, then people can go on reading.

I was thinking of two different kinds of cheatsheets, one pdf that
would fit in a page and could be printed, and one html/markdown,
longer and with more explanation.
>
> > > For me, the most helpful kind of documentation is one that
> explains
> > > by example (e. g. Samba by Example). So I would suggest to write
> > > HowTo sections on Getting Started', Big LaTeX Projects',
> > > Customizing The LaTeX Bundle'. I would be willing to make
> > > additions of my own.

I would say let's try to create some more specific "HowTo" questions,
and then we'll see about answering them. I'll get started on the
cheatsheet for now.
>
> Max

Haris

`

More information about the textmate mailing list