[TxMt] Re: LaTeX Bundle: Wrap in left...right
Ruben Debeerst
ruben.debeerst at gmx.de
Tue Oct 2 13:00:08 UTC 2007
The command you posted didn't work for me. It didn't copy the selected text.
Try this one:
#!/usr/bin/env ruby
sel = STDIN.read.chomp
if ( sel =~ /^\\?\{(.+)\\?\}$/)
print "\\left\\{#{$1}\\right\\}";
elsif ( sel =~ /^(.)(.+)(.)$/)
print "\\left#{$1}#{$2}\\right#{$3}";
end
It will do
{abc} -> \left\{abc\right\}
\{abc\} -> \left\{abc\right\}
and
[abc] -> \left[abc\right]
where in the latter case also other characters than [ ] will work.
Ruben
More information about the textmate
mailing list