# [OS X TeX] automatic superscript braces in TeXShop editor

Herbert Schulz herbs at wideopenwest.com
Sat Feb 4 18:17:28 EST 2012

On Feb 4, 2012, at 4:25 PM, Don Green Dragon wrote:

> Hi Herb,
>
> I'm using TeXShop 2.43 with OS 10.6.8
>
>
>> Open the Key Bindings Editor (Source->Key Bindings->Edit Key Bindings File…) and look at the list. Put ^ in the Input: pane and ^{#SEL##INS#} in the Output: pane and press the + button; that adds the new key binding to the list. Hope this helps.
>
> I went to (Source->Key Bindings->Edit Key Bindings File…) and had a look. Noticed that there was an entry for the empty set which can be created by simply typing \O (uppercase O not zero 0) and found that it works nicely in both text mode and math mode. Granted I get a warning that
>
> LaTeX Warning: Command \O invalid in math mode on input line 21.
>
> when I use it in math mode, but the appropriate character appears in the preview. That's great, but how does one gets the appropriate character in 'Input' column of the Key Bindings Editor?
>

Howdy,

If I type Ø (Shift-Opt-O --- Oh, not Zero --- on a US Keyboard layout) the Keybinding inserts \O in the text. Isn't that what you wish? I wonder if you really want to insert Ø directly into the source file and expect TeX (that has nothing to do with TeXShop) to understand it. If you use UTF-8 input encoding it will work in text mode but not in math mode. That's why that keybinding automatically inserts \O which does work in both text and math modes.

> Also, the use of \neq  in the source code -- without the surrounding \$...\$ stuff -- draws the complaint
> --------
> ./Untitled.tex:24: Missing \$ inserted.
> <inserted text>
>                \$
> l.24 ...not equal to without the dollar signs \neq
> -------
> and after fixing things up for me, the proper "not equal to" glyph appears. But obviously one should fix such deficiencies in the source code.
>

I don't understand? Again, \neq, which is inserted when you type ≠ (Opt-= on a US Keyboard Layout) the Keybindings insert \neq which TeX (not TeXShop) only interprets in math mode.

> For example, I frequently use \$\mathbb{N}\$. I have a shortcut for that but .....  It would be very nice if I could just type \N, for example, in the source code and have the blackboard version of N appear on the preview page.
>
> Don Green Dragon
> fergdc at Shaw.ca

What do you mean by ``shortcut'' above? Why don't you simply put

\newcommand{\N}{\$\mathbb{N}\$}

into your preamble then, whenever you need that simply write \N into your document.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)