[TxMt] Reformatting paragraphs with Textmate's LaTeX bundle

Plessl Christian christian at plesslweb.ch
Fri Jun 15 14:19:46 UTC 2007


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 at plesslweb.ch http://plesslweb.ch






More information about the textmate mailing list