Dear TextMate users
TextMate's LaTeX.bundle is really nice, but there is one thing that bothers me when editing LaTeX documents with hard line wraps.
Reformatting a paragraph (with Crtl + q) does not behave the way I would expect. Emacs is very smart when reformatting paragraphs in LaTeX and I would love to see some of these features in TextMate too:
* currently reformatting an equation or figure environment messes up the layout completely * section titles should be kept on a distinct line and moved within the text * reformatting paragraphs that are commented should adjust the line length and keep the paragraph commented * putting a single % character at the beginning of a line divides a paragraph into 'reformatting units'. When reformatting a paragraph, the reformatting operation does not cross these % boundaries * no reformatting should occur in math environments
In summary, reformatting should adjust the line-length but respect LaTex commands and environments.
It looks like the LaTeX mode currently does not provide LaTeX specific reformatting, but uses standard plain text reformatting.
Would it be difficult to change the behaviour? I assume that implementing smart Emacs-like LaTeX reformatting requires the bundle's grammar to provide a specific scope for marking the unit of text (i.e. a paragraph) that should be subject to the reformatting operation, e.g. text.tex.paragraph.
Does anyone have an idea, how to implement this?
Best regards, Christian
-- Christian Plessl christian@plesslweb.ch http://plesslweb.ch
You might try using the Tidy command in the Latex bundle. It appears however that the command eats line endings, thus ruining your hard wraps. This command calls a well commented perl script which perhaps you can adjust to your needs. In general it seems that language specific functionality is implemented in bundle items rather than default TM behaviors. HTH
Peter
On 6/15/07, Plessl Christian christian@plesslweb.ch wrote:
Dear TextMate users
TextMate's LaTeX.bundle is really nice, but there is one thing that bothers me when editing LaTeX documents with hard line wraps.
Reformatting a paragraph (with Crtl + q) does not behave the way I would expect. Emacs is very smart when reformatting paragraphs in LaTeX and I would love to see some of these features in TextMate too:
- currently reformatting an equation or figure environment messes up
the layout completely
- section titles should be kept on a distinct line and moved within
the text
- reformatting paragraphs that are commented should adjust the line
length and keep the paragraph commented
- putting a single % character at the beginning of a line divides a
paragraph into 'reformatting units'. When reformatting a paragraph, the reformatting operation does not cross these % boundaries
- no reformatting should occur in math environments
In summary, reformatting should adjust the line-length but respect LaTex commands and environments.
It looks like the LaTeX mode currently does not provide LaTeX specific reformatting, but uses standard plain text reformatting.
Would it be difficult to change the behaviour? I assume that implementing smart Emacs-like LaTeX reformatting requires the bundle's grammar to provide a specific scope for marking the unit of text (i.e. a paragraph) that should be subject to the reformatting operation, e.g. text.tex.paragraph.
Does anyone have an idea, how to implement this?
Best regards, Christian
-- Christian Plessl christian@plesslweb.ch http://plesslweb.ch
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Thanks to Peter and Jacob for your reply.
As far as I understand, I will need two things a) a command line command that reformats a given block of LaTeX code the way I like, and b) I need to modify the LaTeX grammar, such that reformat can be restricted to the desired scope (a paragraph).
I will start with looking into solutions for a
Best regards, Christian
On 15.06.2007, at 22:09 Uhr, Peter Cowan wrote:
You might try using the Tidy command in the Latex bundle. It appears however that the command eats line endings, thus ruining your hard wraps. This command calls a well commented perl script which perhaps you can adjust to your needs.
In general it seems that language specific functionality is implemented in bundle items rather than default TM behaviors.
-- Christian Plessl christian@plesslweb.ch http://plesslweb.ch
On Jun 16, 2007, at 9:43 AM, Plessl Christian wrote:
Thanks to Peter and Jacob for your reply.
As far as I understand, I will need two things a) a command line command that reformats a given block of LaTeX code the way I like, and b) I need to modify the LaTeX grammar, such that reformat can be restricted to the desired scope (a paragraph).
I will start with looking into solutions for a
The correct version of what you want in (b) can be easily achieved, (a) is the difficult one, so if that is done, we can easily add the command part.
PS: Sorry for not responding earlier to your offline email, been away from email contact for a month.
Best regards, Christian
On 15.06.2007, at 22:09 Uhr, Peter Cowan wrote:
You might try using the Tidy command in the Latex bundle. It appears however that the command eats line endings, thus ruining your hard wraps. This command calls a well commented perl script which perhaps you can adjust to your needs.
In general it seems that language specific functionality is implemented in bundle items rather than default TM behaviors.
-- Christian Plessl christian@plesslweb.ch http://plesslweb.ch
Haris Skiadas Department of Mathematics and Computer Science Hanover College
Plessl Christian wrote:
TextMate's LaTeX.bundle
⋮
Reformatting a paragraph (with Crtl + q) does not behave the way I would expect.
If you can find or create a command-line program or script that formats LaTeX code the way you like, then you can trivially add it to the LaTeX bundle.