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

Don Green Dragon fergdc at Shaw.ca
Thu Feb 9 04:32:04 CET 2012

```Hi Herb,

On 04Feb2012, at 4:17 PM, Herbert Schulz wrote:

<<snip>>
>> 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 did not know about Shift-Opt-O for example.

> 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.

Insert the character 'Ø' into the source file??? I was not trying to do that!

> 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.

Very good. Like the typeset version of \O much better than \emptyset.

<<snip>>
> 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.

Did not know about Opt-= producing ≠ at least here in Mail.app.

>> 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.

That's the shortcut I alluded to, although I also include \ensuremath so that \N  works well in text mode. However, I misjudged that the equivalent could be done with the Key Bindings Editor.

As always, thanks for you help.

Don Green Dragon
fergdc at Shaw.ca

```