[OS X TeX] key bindings in ``math mode'' only

Nicolae Garleanu garleanu at haas.berkeley.edu
Sat Jun 1 18:22:32 CEST 2013

Thanks, Herb.
What I ended up doing, by the way, was very close to your macro
suggestion, but simply as a key binding. (Alt+Shift+_ bound to `-'.)

On 6/1/13 8:58 , "Herbert Schulz" <herbs at wideopenwest.com> wrote:

On May 25, 2013, at 2:04 PM, Nicolae Garleanu <garleanu at haas.berkeley.edu>

> There is perhaps another possibility. Can one set it up so that,
> (i) if one types, say, xt+1, then highlights (shift back arrow) t+1 and
> types _, one ends with x_{t+1} and the cursor after the closing bracket;
> (ii)  if one types just _ (nothing highlighted), then only _ is written?
> In other words, change the key binding so that it works only for
> *non-empty* selections? (And move the cursor to the end thereafter, but I
> think that that's just a matter of moving #INS#?)
> Nicolae


I'm sorry for coming back to this so late but it has been such a long time
since I looked at keybindings that I didn't realize that the #SEL# (the
selection) CAN be part of the key binding. E.g., I have _ bound to
_{#SEL##INS#} so pressing _ will surround any existing selection with _{
and } while leaving the insertion point between the braces. If you want
the insertion point to end up outside the braces bind _ to _{#SEL#}#INS#
(even _{#SEL#} might work though I haven't tried it.

Sorry to come back to this so late.

By the way the keybindings code is smart enough that if you type \_, to
get an underscore in typeset text, it will NOT expand the _. If you want
to type _ by itself, e.g., in verbatim text or a url, you will still need
the macro.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
List Archive: http://tug.org/pipermail/macostex-archives/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex

More information about the macostex-archives mailing list