# [TxMt] Folding in LaTeX

Daniel Käsmayr daniel at kaesmayr.net
Thu Apr 6 15:50:13 UTC 2006

Dear fellow LaTextmaters,

I am (again) fiddling with the LaTeX bundle (seem to do that too much
and write my thesis too little --- ah well). and am trying to find
some way to add better folding recognition.

However, I would like things to be a bit easier, maybe I am just a
bit slow-minded today:

Right now I am trying something similar to the HTML.bundle:

foldingStartMarker = '(?x)
(\\chapter\{.*\}
|\\begin\{.*\}
)';
foldingStopMarker = '(?x)
(\%endchapter\{.*\}
|\\end\{.*\}
)';

Which will add folding marks to chapter headlines and custom comments
that show the end of a chapter (or section, subsection etc.). Which
works fine, but instead of having to type out every possibility I was
hoping to do this:

foldingStartMarker = '(?x)
(\\(chapter|section)\{.*\}
|\\begin\{.*\}
)';
foldingStopMarker = '(?x)
(\%end(chapter|section)\{.*\}
|\\end\{.*\}
)';

Works only if the indentation is correct. (Which might get annoyingly
deep if this is done in depth).

\chapter{chapter}
\section{section}
%endsection{}
%endchapter{}

Is there a way to get folding to recognize the foldingStopMarker as
"the line before it hits a certain pattern"? So I can fold (marked
with *)

*	\section
…

*
\section

thx,

Daniel

PS: btw, when editing this email in Txtmate and returning to Mail.app
the indentations were all gone.


More information about the textmate mailing list