2011-10-31

Use shortcut keys to easily type 〚 and 〛 (\[LeftDoubleBracket] and \[RightDoubleBracket])

Using [[ and ]] for indexing is not very readable when you have lots of nested expressions and typing ESC [[ ESC is not too convenient (four keystrokes, two of which is pressing ESC in the far left corner of the keyboard). Fortunately, it is possible to assign keyboard shortcuts to symbols, in the following way:

Find the file Mathematica\(version)\SystemFiles\FrontEnd\TextResources\Windows\KeyEventTranslations.tr and back it up before making any modifications. Find the line EventTranslations[{ and add the following two lines right after it:
Item[KeyEvent["[", Modifiers -> {Control}],
FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`InputNotebook[],
"\[LeftDoubleBracket]", After]}]],

Item[KeyEvent["]", Modifiers -> {Control}],
FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`InputNotebook[],
"\[RightDoubleBracket]", After]}]],
Now restart the front end and you should be able to type these characters using CTRL-[ and CTRL-]! This has been tested with Mathematica 5.2 and 6.0 on Windows.

Note: If you keep the backup of KeyEventTranslations.tr in the same directory, make sure that its extension is NOT .tr, otherwise this trick will not work.

2005-05-12

Weblog created

Nothing to see here, move on.