# Is there any LaTeX editor allowing you to tab through curly braces?

I tried several LaTeX editors with auto-completion functionality, but none of them make life easier. The problem is when they auto-complete a command, such as \frac, they usually add {} automatically and you have to use the arrow keys to navigate out of the braces. But arrow keys are far away from the center of keyboard and pressing them really slows down my editing process. Is there any LaTeX editor that allows you to use Tab key to jump from braces?

-
Based on the “But arrow keys are far away from the center of keyboard”, I’d suggest checking out Vim. Although it should be mentioned that it has a rather steep learning curve. –  morbusg Mar 21 '12 at 8:55
vim is the only way to go. –  romeovs Mar 21 '12 at 10:21
Emacs is the one and only way to go ;-). –  mhp Mar 21 '12 at 11:11
Oh, speaking of learning curves (I'm glad Emacs got mentioned): bit.ly/zECzq –  morbusg Mar 21 '12 at 16:39

In TeXstudio (formerly called TexmakerX) you can easily do that as it allows you to define custom keyboard shortcuts.

Under "Options" -> "Configure TeXstudio..." -> "Shortcuts" -> "Editor" -> "Basic Key Mapping", you can redefine the shortcuts for the commands "Next placeholder" and "Previous placeholder" or "Next placeholder or one word right" and "Previous placeholder or one word left".

It's a workaround and it allows you to jump from the one bracket to the other quickly. You can also try to redefine shortcuts for "Move cursor right/left" (which are mapped to the arrow keys originally) or "Move cursor right/left (1 word)" commands , as long as you can get used to it :-)

-
I changed the Basic Key Mapping "Next placeholder or one word right" to Tab. Now I can use Tab to jump to next placeholder and get out of the braces. Exactly what I need! –  C.R. Aug 12 '12 at 4:03

In Emacs, an experienced user (i.e. a user considering arrow keys and the like a no-no) would use a combination of C-f (forward-char), C-b (backward-char), C-M-f (forward-sexp) and C-M-b (backward-sexp) for this purpose.

If you are ambitious enough to internalize these commands you will get really fast.

PS: C denotes the Control key and M (normally) the Alt key.

-
with emacs, your fingers never need to leave the "home keys". thus, a perfect tool for someone who can touch type but suffers pain whn using a mouse. yes, a high learning curve, but with a big payoff. –  barbara beeton Mar 21 '12 at 13:17

AFAIK, TeXworks has a similar functionality. And Emacs being a programmable editor, it is certainly possible to do it in it.

In fact, you could use yasnippet instead of C-c m, which could be both faster and have the functionality you describe. You can configure it easily to be able to type, e.g., f r <tab> and have it expanded to \frac, with <tab> (or some other key, don't remember now) move the point (cursor) to the desired locations.

-
This is what I use. –  mrf Jun 28 '12 at 21:06

You need to have an editor with scripting facilities : for example on OS X with Textmate, I created a snippet for frac like this

    \frac{${1:num}}{${2:den}}\$0


and with TAB I go from the first braces (inside) to the second braces (inside) and then to outside. I know that some editors now use snippet like Textmate.

-
VIM supports the TextMate snippet syntax vie the snipMate plugin. –  Daniel Dec 18 '13 at 9:36

Texmaker uses place holders if you're using the auto-complete function, for which you use Shift+Tab, see section 4.12 in the manual.

TeXworks also uses place holders when auto-completing, and you use Ctrl+Tab to reach them, see section 4.6 in the manual.

-
I know the placeholder. But the placeholders are in the braces; It looks like this in TeXMaker: \frac{•}{•}. So after I type the content in the second braces, I still have to use arrow keys to move past the '}'. –  C.R. Mar 21 '12 at 9:10
TeXworks has advanced scripting languages, so maybe you can write a module with the functionality, or convince some other to do that. You can also contact the authors of TeXmaker or TeXworks and persuade them to add the capability you desire. –  Sveinung Mar 21 '12 at 9:36

The Vim-LaTeX package gives GVim this feature, e.g. pressing / generates \frac{<++>}{<++>}<++> and then Ctrl+J jumps to the next placeholder. You still have to reach for the Ctrl key, but this is the cleanest such feature I've been able to find.

I'm looking to introduce my younger brother to TeX with something less idiosyncratic than Vim (even though one could use Cream for more simplicity) - and it looks like I will end up using TexMaker. I like the fact that it is cross-platform, and at least you can move from brace-set to brace-set easily, even if you do have to resort to an arrow key to leave.

-

Winedt is highly programmable too. As a default Ctrl+Space jumps to the next (a sort of bullet). This is used e.g. for environments with arguments. It wouldn't be very difficult to change to auto-complete commands so that they add such a bullet after the last brace/the end of an environment to which you could jump.

I personly dont 't need this. I'm used to the arrows.

Btw: Winedt 7 has just been released. It can now handle unicode.

-

I mapped my arrow keys to Alt+WASD globally with AHK. I presume you could do something similar under *nix. Nice thing is, it works everywhere (text fields on stack exchange, for instance).

-
Welcome to TeX.SX. By AHK, do you mean AutoHotKey? –  Torbjørn T. Dec 18 '13 at 8:55
Yep. It's a pretty good solution, aside from occasional lag. –  Mark Dec 18 '13 at 8:57
Which editor are you using? –  Charles Stewart Dec 18 '13 at 9:05
Texmaker, but the script works in any application, be it a word processor, browser, command line, another IDE, etc. –  Mark Dec 18 '13 at 9:16