[TxMt] Re: LaTeX Bundle: Wrap in left...right

Alain Matthes alain.matthes at mac.com
Tue Oct 2 10:32:47 UTC 2007


Le 2 oct. 07 à 09:12, Ruben Debeerst a écrit :

> On 2007-09-19 19:25:58 +0200, Alain Matthes <alain.matthes at mac.com>  
> said:
>
>> but I will prefer
>> "{something}" into "\left\{something\right\}" but I don't know
>>   how to make  a conditional insertion
>
> Yeah, I don't know how to do conditionals in snippets either. But  
> you could make another snippet with
> ${TM_SELECTED_TEXT/{(.*)}/\\left\\{$1\\right\\}/}
>
>

yes firstly i made this but the next command is useful :

#!/usr/bin/env ruby

sel = STDIN.read.chomp
sel.match(/^(.+)(.)$/)
left = $~[1]
right = $~[2]
if right == '}'
    left = '\\{'
    right = '\\}'
  end
print "\\left#{left}\\right#{right}"

Regards Alain


More information about the textmate mailing list