Home Download Buy Blog Forum Support

Modify auto-complete for multi-character brackets? (LaTeX)

Modify auto-complete for multi-character brackets? (LaTeX)

Postby Verdigris97 on Sun Nov 25, 2012 12:01 am

I searched around a bit for this, and it seems like there should be a way to fix this pretty easily, but I can't quite figure it out.

When I'm in a LaTeX document, and I open math mode with "\(", the auto-complete gives me a ")". (And similarly for "\[" and "]")

I'd like for ST2 to either ignore the left bracket (maybe it could recognize the escape sequence?), or, even better, auto-complete it with a two-character sequence, "\)", or "\]", as appropriate.

A snippet would work, but that would require disabling auto-complete for brackets since the snippet fires after the auto-complete places the extra bracket at the end (which you can't tab past to escape the snippet scope, since it isn't in the snippet).

I would like to keep auto-complete on for non-escaped brackets, but if turning it of is the easiest way to deal with this, I guess I can live with it... although I'm not sure of all of the ramifications of doing that.

Do most people turn off auto-complete for brackets in LaTeX files? Am I missing another way of dealing with this?
------------------------------------
Professor. Father. Idiot.
Verdigris97
 
Posts: 2
Joined: Sat Nov 24, 2012 11:44 pm

Re: Modify auto-complete for multi-character brackets? (LaTeX)

Postby sfranky on Sun Nov 25, 2012 3:45 pm

I'm having the same issue, can anyone help?
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Modify auto-complete for multi-character brackets? (LaTeX)

Postby Verdigris97 on Wed Nov 28, 2012 4:27 pm

For now I've just disabled auto-complete for brackets in LaTeX files, and I have two snippets that are getting the job done.

One for math mode:
Code: Select all
<snippet>
   <content><![CDATA[
\($TM_SELECTED_TEXT$1\)
]]></content>
   <tabTrigger>\(</tabTrigger>
   <scope>text.tex.latex</scope>
</snippet>

and one for display math mode:
Code: Select all
<snippet>
   <content><![CDATA[
\($TM_SELECTED_TEXT$1\)
]]></content>
   <tabTrigger>\(</tabTrigger>
   <scope>text.tex.latex</scope>
</snippet>


Does anyone have a better solution to this? Thanks.
------------------------------------
Professor. Father. Idiot.
Verdigris97
 
Posts: 2
Joined: Sat Nov 24, 2012 11:44 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 18 guests