[TxMt] LaTeX sub/superscript snippet

Guido Governatori guido at itee.uq.edu.au
Sat Feb 2 20:27:29 UTC 2008

I'm trying to define a "smart" snippet for LaTeX sub/superscript.  
What I would like to achieve is a snippet

(1) triggered by _ (or ^ for superscripts)
(2) curly braces are inserted only when there are least two  
characters after _

Thus, if I type

_a, then I get _a

if I type

_ab then I get _{ab}

My current attempt is as follows:


However, the above has a major shortcoming:

When I type _ as the second character after the first _, then the  
caret is in the wrong place. Thus,




and the caret is between a and _ instead of being after the second _

Any suggestions?

Dr Guido Governatori
School of Information Technology and Electrical Engineering
The University of Queensland
Brisbane, Queensland, 4072, Australia
Phone: +61-(0)7-336 52907
Fax: +61-(0)7-336 54999

More information about the textmate mailing list