6
$\begingroup$

A lot of my use for Mathematica is creating notebooks that read like textbooks. For this reason, most of my time is spent in text cells. As I type in a text cell, I am constantly creating inline cells. I find the Control + 9 method for creating an inline cell annoying, difficult and time consuming.

I'm hoping to use the Fn key on the lower left-hand side of the keyboard instead of having to type Control + 9. This would be easier because its one key and its easy to get to. On top of that, I never use the Fn key for anything... so its available.

I can't seem to figure out how to do this. I know its possible. I've tried using modifying keyeventtranslations. Currently I have the following code in keyeventtranslations.nb

Item[KeyEvent["9", Modifiers -> {Control}], "CreateInlineCell"] 

It seems it would be easy to do what I want if I knew the keyevent for the Fn key. But I don't. I don't think Mathematica recognizes this key at all for some reason. I can't seem to find it anywhere in the documentation either. So this leads to a dead end as far as I can tell.

Do you have any advice on go about going this another way?

$\endgroup$
5
  • $\begingroup$ Does Item[KeyEvent["F9"], ...] (for the function key 9) work? Looking at the file KeyEventTranslations.tr, it seems to be done this way. (I did not try it myself.) $\endgroup$ Commented Nov 11, 2016 at 1:32
  • $\begingroup$ No this doesn't work either. I don't think Mathematica recognizes the functions keys at all. I'm thinking there is probably a way hack this by creating a hot key in OS X settings that creates a character which Mathematica recognizes which then turns into "CreateInlineCell". Kind of a shortcut to a shortcut to the solution. But I can't figure it out. $\endgroup$ Commented Nov 11, 2016 at 1:44
  • 1
    $\begingroup$ I just tried it on Windows and it doesn't work as well. I tried also with a few modifiers but without success. I can see at the end of the file "F1" and "F2" being used, and I interpreted the former as the shorcut for opening the documentation center. Now I am seeing that this is SelectionHelpDialog[False] and not the token "SelectionHelpDialog", so maybe this is for another thing. I am not sure how one can get the function keys to work, which could be really nice indeed. $\endgroup$ Commented Nov 11, 2016 at 2:14
  • 2
    $\begingroup$ This may not be possible, at least not directly in Mathematica. This is a very special modifier that is used to type keys that are not physically present on a laptop keyboard. Mathematica probably isn't even able to see this as a separate key. I mean that when you type Fn-Down, it probably sees it as the same PgDn as the one you could type on a large keyboard having a separate PgDn key. It probably doesn't see it as Down with the Fn modifier. $\endgroup$ Commented Nov 11, 2016 at 21:33
  • $\begingroup$ Ok. What about the caps lock key? Can I edit keyeventtranslations.nb to make the caps lock key create inline cells? $\endgroup$ Commented Nov 11, 2016 at 21:35

1 Answer 1

5
+200
$\begingroup$

In MacOS system preferences you can assign any shortcut to a menu item. You can do that for "Start Inline Cell" (^9) and assign it to whichever key you like.

Function keys can be touchy though, you may find that apps like FunctionFlip and Karabiner-Elements will help.

Here is one way to go about it:

  1. In Karabiner-Elements assign the Fn key to some unused key (I tried Keypad_9 as my Macbook does not have a keypad)
  2. Then in system preferences assign "Start Inline Cell" to Keypad_9 (by pressing Fn)

That is is! You can probably do this with the caps-lock key just as well.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.