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

Nicolae Garleanu garleanu at haas.berkeley.edu
Sat May 25 15:04:41 EDT 2013

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#?)

On 5/23/13 15:33 , "Herbert Schulz" <herbs at wideopenwest.com> wrote:

On May 23, 2013, at 5:23 PM, Gary L. Gray <gray at psu.edu> wrote:

> On May 23, 2013, at 4:52 PM, Nicolae Garleanu
><garleanu at haas.berkeley.edu> wrote:
>> I was thinking about key bindings again today, and one thing I wish I
>>could do is the following: continue to obtain _{} every time I type _,
>>but only inside a math environment, between $ signs, etc. As an example,
>>if I want to write in my tex file the name of another file (say, a
>>graphics file to include) that contains the character `_', now I have to
>>erase curly brackets. One option is to avoid such characters from file
>>names. If there is a simple way of applying the bindings only in math
>>mode, though, then I could implement that. (Anything complicated will
>>probably not be worth anyone's time.) Is there one?
> I must say that after many years of using TeXShop's default "_{}" when
>an underscore is typed, I have switched it off. TeX is more than happy
>with $x_A$, and using $x_{A}$ is extra key strokes to get myself out of
>those darn curly braces. If I have a more involved subscript requiring
>the {} pair, I would rather type them in myself.
> That's my wisdom for the day. I am spent.
> Gary


Just curious... did you switch off all bindings or just remove that one?

I guess it depends upon how often you need the brace pair. If you have
multi-character sub/super-scripts often it will be two keystrokes (either
{->{#INS} and another to go past the } -- or -- { and } if you don't have
that keybinding). On the other hand if you usually have just one
character, e.g., x^2 or x_i, you are right. I've messed that up way too
often so having ^->^{#INS}, etc., doesn't bother me.

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 MacOSX-TeX mailing list