Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I tried to modify the file in order to always place a closed bracket instead of an open bracket once I press [. However once I press [ after the modification nothing happens (the cursor just stays at the same position and not even a [ is placed).

                "[", After],
                "]", Before]

the Code is a slight modification of what i found regarding double brackets:

Automating Esc [[ Esc formatting?

(There is a comment below the top answer, which also mentions Problems regarding [ and German keyboard language).

If I use a different character like / to trigger the KeyEvent, which does not have to be typed using the AltGr-key

                "[", After],
                "]", Before]

the closed bracket will be placed as expected. Other keys like { using AltGr do not work either.

I tried renaming the term.dll files as suggested here:

Is it possible to get AltGr key to work in Math.exe?

unfortunately this did not fix the Problem.

Additional Information: I'm using Win7 and my keyboard language is set to German. (And I would like to keep it set to German).

If there is any other way circumventing the to automaticaly place [] with the cursor placed between the brackets once I press [, it would be fine as well.

Thanks in advance if anyone tries to answer my question :)

share|improve this question
Are aware of the fact that Alt-] inserts a matching [ ] pair? No modifications necessary. – Sjoerd C. de Vries Apr 13 '14 at 13:17
With keyboard language set to german that does not work for me. Pressing AltGr-Alt-8 (AltGr-]) does not yield any front end input for me. As a side note: Pressing Ctrl-Alt is equivalent to pressing AltGr on my keyboard. – Max1 Apr 13 '14 at 13:50
With exception to basic editing and saving commands (Ctrl-A, Ctrl-S etc.) keyboard shortcuts do not work when keyboard locale is not set to English. Also the FrontEnd generally cannot handle correctly characters outside of Unicode level 0. – Alexey Popkov Apr 13 '14 at 16:05
How about using FrontEndExecute[FrontEndToken["InsertMatchingBrackets"]] instead of the two FrontEndExecutes you used? – Sjoerd C. de Vries Apr 13 '14 at 16:12
@SjoerdC.deVries I just tried, but it did not work. The problem is probably the KeyEvent["["]. In case there exists no proper solution I will just map [] to ), since I mapped () to ( I dont really need the ) key anymore. – Max1 Apr 13 '14 at 16:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.