[TxMt] Reformat paragraph and the LaTeX mode
Eric Hsu
erichsu at math.sfsu.edu
Tue Jan 10 17:12:27 UTC 2006
At 8:16 AM -0600 1/9/06, Charilaos Skiadas wrote:
>On Jan 9, 2006, at 3:59 AM, Marco Kuhlmann wrote:
>>No, tidy does not really do what I want to achieve here. I also
>>must admit that the LaTeX bundle's authors' idea of tidyness does
>>not really match mine ... ;-)
>>
>I think Eric Hsu is responsible for the perl script used, and he
>seems to have it pretty well documented. It resides in
>Library/Application
>Support/TextMate/Bundles/Latex.tmbundle/Support/bin
>so you could try to toggle it to suit your purposes, it does a lot
>of stuff that most some people might not like I guess. He is in the
>mailing list I think, so he might add his input when he gets a
>chance. I personally have never used the script.
Hi. The tidy script is pretty simple and (as I recall) was a hack to
tab indent to allow intelligent folding of LaTeX documents. I wrote
it in 2004 so it's fuzzy in my mind. Everyone is welcome to improve
it.
>>Reformat Paragraph is really close to what I want, and in fact
>>would be exactly what I want, if a paragraph would indeed be a
>>logical LaTeX paragraph (rather than a textual paragraph) for
>>Textmate.
I don't understand what that means, but I'm not a LaTeX geek. Does
that mean that you want a command to remove all line breaks and
insert breaks before logical separators, like \item and \section,
etc.? How far away is LaTeX Tidy, assuming it could work on a
selection?
>>So do I get you right that it is not possible for a language
>>definition to specify what it counts as a paragraph?
>>
>That is correct, to the best of my knowledge.
>You could ask it as a feature request, though it will probably have
>to wait until 2.0 at least.
It seems like it would be a straightforward command to write. I
would think the fastest thing to do would be to write a little
command that inserts line breaks before all the things you don't want
broken and then run a macro to Reformat Paragraph and then run your
little command.
The insert line break command would be something like (off the cuff)
perl -pe "s/(\\item|\\section|\\subsection)/\n$1/g"
Good luck. If you can't do it, perhaps someone else on the list with
some time, or wanting to practice writing a simple TM command could
do it... My wonderful 7-month old daughter has reduced my
programming productivity...
best, Eric
ps. The LaTeX bundle has changed a lot (in cool ways) since I last
worked on it. However, I don't get why there is no built-in way to
wrap text in \[ \] or \( \), since this is by far the most common
move I make. Does anyone have objections to me adding such commands?
If so, what is the recommended way of doing this with the existing
bundle?
--
Eric Hsu, Assistant Professor of Mathematics
San Francisco State University
erichsu at math.sfsu.edu
http://math.sfsu.edu/hsu
More information about the textmate
mailing list