[TxMt] Regarding the LaTeX bundle

Charilaos Skiadas skiadas at hanover.edu
Tue Sep 12 13:17:10 UTC 2006


Before I answer this, let me take the opportunity to mention one big  
change that Michael Sheets just implemented, namely:

Root scopes of the various TeX/LaTeX grammars changed to bring them  
in-line with each other. TeX – text.tex, LaTeX – text.tex.latex, TeX  
Math – text.tex.math, Beamer – text.tex.latex.beamer, BibTeX –  
text.bibtex, and LaTeX Log – text.log.latex

What this means in practice is that any customizations you had in any  
way, which used the LaTeX grammar, and probably had a scope selector  
of text.latex, should have that selector renamed to text.tex instead.
We apologize for the inconvenience, but there are a series of  
technical, as well as TeXnical, reasons why this is better.

And now, we resume with our regular program...
On Sep 12, 2006, at 4:33 AM, Alan Schmitt wrote:

> On 12 sept. 06, at 08:31, Charilaos Skiadas wrote:
>
>> That's exactly why I advocate the use of \( \).
>>
>> (we could actually make it so that pressing the dollar sign  
>> produces the \( \) pair instead ;). )
>
> This would be nice ;-) I used to use \( \) all the time, but I  
> don't like how it becomes \() when I type in (because of auto- 
> closing the bracket).

Well, I was actually kidding, but if you do want to do this the  
simplest thing would be to create a new snippet with key equivalent  
$, and with text: “\( $TM_SELECTED_TEXT$1 \)” without the quotes.  
Then you can tab out of the math environment, provided you don't use  
a different snippet while in there. This also allows you to enclose  
something in a math environment simply by selecting it and then  
pressing $.

The only thing remaining is an easier way to get out of the math  
environment, perhaps by pressing $ anywhere in an existing math  
environment. You could that by a macro that searches for a regular  
expression (?<=\\\))

This is just an idea, it has some problems that would need to be  
smoothed out. First of all, inserting an actual dollar sign is more  
difficult, but we could allow it by having the above not work after a  
slash (for escaped dollar signs) and not work in verbatim  
environment. (see http://macromates.com/textmate/manual/ 
scope_selectors#scope_selectors, section 13.3)

second, I often find that while in math, I use $ to split a math  
formula in two. So perhaps inside a math environment it might be best  
for $ to do that.

All these would, if they become official in any way, go into the  
separate LaTeX Experimental bundle, so that people who do not want  
them could disable them.




Another simpler thing you can do, which doesn't conflict with the use  
of $, is to create a snippet, with tab trigger \(, which would insert  
“\\( $0 \\”, without the quotes. It's not perfect, but it's a start.  
Try it out and see if it works. You would need to press a tab after  
the \( of course.
One could instead set the snippet to have a key equivalent of (, have  
a scope that only triggers it when the caret is after a \ (which is  
actually not too easy to do now that I think about it), and have its  
text be “( $1 \\)” without the quotes.

> Alan
>

Haris





More information about the textmate mailing list