# [TxMt] Regarding the LaTeX bundle

Sun Sep 10 22:49:41 UTC 2006

On Sep 10, 2006, at 5:26 PM, Jenny Harrison wrote:

> Dear Harris, Allan, Max, Dan, ...
>
> I have an idea of a fix for folding of sections.  Whenever I talk a
> Latex user into trying out TextMate the first response is invariably,
> "Folding on its own is worth its weight in gold."   Yet folding of
> sections does not work well and I have quit trying to do it. The
> problem is this: if I create a custom fold for a selection, the fold
> marks usually vanish when I return to it and edit.   I then have to
> reselect the  material which is counter to the TextMate philosophy.

Actually, I think there might be a simple fix, without having to stop
using the more standard \section commands.
A new folding option has been added, so that lines of the form:

% stuff here (fold)
.....
% other stuff here (end)

will fold, the key here being the words (fold) and (end) in
parentheses and at the end of a comment line. So we could have the
sectioning commands create:

\section{section name}\label{sec:section_name}
% begin section section name (fold)
% end section section name (end)

Then you could fold all but the \section line.

And there is also what Dan suggested, i.e. to just have the (end)
line, and to add the \section... lines to the list of acceptable
folding markers.

On Sep 10, 2006, at 6:41 AM, Daniel Käsmayr wrote:
> Dear Haris, Allan, Max and all the LaTeX-ed Maters out there…
>
> Am 10. Sep 2006 um 05:12 schrieb Charilaos Skiadas:
>
>> On Sep 9, 2006, at 6:40 PM, Max Lein wrote:
>>>
>>> (i) No known command list: suggestion: type command: text stays
>>> grayish-blue until a command is recognized. Then the text turns
>>> dark blue. Basically there should be user feedback whenever a
>>> command is recognized.
>>>
>>> I can provide you with a list of official' LaTeX commands if
>>> needed.
>
> a very good idea, but I would like to have two such lists. One for
> the official commands, and another one for bundle commands
> (possibly including the most used ones) that is also user
> configurable, maybe via a TM_LATEX_BLABLA variable? As an example:
> I have used glosstex and there are quite a bit of possibly commands
> coming with it (as mentioned previously on the list where I posted
> a snippet of my personal flavor of the latex.grammar). Also I would
> love to have my custom commands as defined in my preamble color-
> coded, but thos would either have to be parsed by a script or added
> manually to the "second" list.

The problem with this is that the grammar has a kind of static form.
>
> Folding: I have toyed with changing my snippets for the headings to
> include a commented line corresponding to the heading and then have
> TM fold over the two, such as:
>
> \section{section name}\label{sec:sectionname}
>
> %endsection
>
> This works when the grammar contains the correct folding start- and
> stop- markers.
>
> Footnote coloring was one of the first things I added to my
> tmTheme ;) If we added a snippet "fn" that created a footnote
> beginning on a new line and provided some help for folding I
> believe this would do as well, not?

Currently, pressing fn and then cmd-} results in "\footnote{}". You
can change that by editing the latex_config file via the command in
the bundle, and changing the line:

fn = '\\footnote{$1} '; to: fn = '\n\\footnote{$1} ';

or perhaps even better:

fn = '%\n\\footnote{\$1} ';

Not really sure how to achieve the folding.
>
>> Of course, you can easily change this in your own copy, by opening
>> the bundle editor and finding the appropriate drag command. All
>> you have to do is change the \\\\include that appears there to \\\
>> \input.
>
> Or set a TM_VARIABLE? I am always a bit careful about changing the
> predefined bundles - you do lose any upcoming updates, although one
> could expect no major changes at a certain level of maturity of the
> bundle. But debugging things will become quite difficult… or have I
> missed an important change in the way things are handled?

We are trying to keep the number of TM_VARIABLE's to a bare minimum,
in favor of using the LaTeX configuration file for customization. As
far as changes go,TextMate uses a "deltas" system now. What this
means is that if you change any aspect of a bundle command, then this
change is kept in a "delta file" and is merged with whatever the
current command is, so you can stay updated on other aspects. In this
particular case, the only thing you would miss is if we changed the
actual text of the drag command.

Btw, this delta idea applies equally well to shortcuts. You can now
safely change the shortcut for a command, and rest assured that the
actual text of the command will remain up-to-date if we change it at
a later date. The only thing not up to date would be the shortcut.

>>
>>> (vii) You already have tab triggers for section, subsection and
>>> subsubsection, so how come chapter is missing?
>>
>> allan: (vii) oversight (and we rarely need it)
>
> is it missing? I have one sitting here in my "sec" snippet, but
> then I do have many changes in the bundle itself and not all of the
> migrated out to my personal flavor… ;)
>
A snippet for "chapter" is missing. There are snippets for sections.

>>> (viii) A way to execute bibtex (and pdflatex twice to see whether
>>> all additional citations have been included).
>>
>> allan: (viii) latexmk.pl should do that — maybe we should make
>> this the default, not sure if that would bother anyone (maybe some
>> workflows would mean much more time typesetting)
>>
>> me: latexmk.pl will actually do a lot more for you. The Help file
>> should describe how to set it up. I'd personally prefer not to
>> have it as the default. It is however easy to set it in your system.
>
> Is it normal that latexmk.pl does 6 runs of pdflatex? I have found
> this to be too slow for most things and added my own "render"-
> commands; but I also had to include glosstex in the mix… Is there
> some easy way to configure this? But maybe one can expect that most
> latex-users would be able to hack their own changes into the
> bundle, but a certain level of comfortable configuration might be
> useful as well - best achieved by setting TM_VARIABLE, not?

The help does briefly mention that you can use your own script for
the compiling. It doesn't provide many details since that would be a
bit too technical.

Haris

`