Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In version 8 I was a frequent user of the "Use shortcut keys to easily type〚 and 〛" trick.

In version 9, when I try to make the necessary change to KeyEventTranslations.tr, the \[LeftDoubleBracket] and \[RightDoubleBracket] get immediately changed to doubled single-brackets ([[ and ]]). And indeed the shortcuts work, but they insert the doubled single-brackets instead of the single double-brackets. How can the brackets' doubleness be preserved in KeyEventTranslations.tr?

share|improve this question
    
This shortcut is the subject of this answer. –  ArgentoSapiens Jan 30 '13 at 16:21
1  
You should enter it via a text editor like vim/emacs (or any other). If you edit it via the front end, it will convert it to [[ –  rm -rf Jan 30 '13 at 16:57
2  
Yes, it works in v9 without problems. Just use a plain text editor to edit KeyEventTranslations.tr. Do not use Mathematica to edit that file because it may break it. If you did edit it with Mathematica, try to get the original file from the installer and restore it. –  Szabolcs Jan 30 '13 at 17:29
add comment

1 Answer

up vote 6 down vote accepted

I do believe that it should still work under V9, however I personally have added my shortcuts to MenuSetup.tr rather than KeyEventTranslations.tr and they read:

Menu["&Typesetting",
{
...  
    Delimiter,
(*My typesetting shortcuts*)
    MenuItem["Matching ()", FrontEndExecute[{FrontEnd`NotebookApply[FrontEnd`InputNotebook[], "(\[SelectionPlaceholder])"]}],
         MenuKey["8", Modifiers->{"Control","Shift"}]],
    MenuItem["Matching []",FrontEndExecute[{FrontEnd`NotebookApply[FrontEnd`InputNotebook[], "[\[SelectionPlaceholder]]"]}], 
        MenuKey["9", Modifiers->{"Control","Shift"}]],
    MenuItem["Matching {}", FrontEndExecute[{FrontEnd`NotebookApply[FrontEnd`InputNotebook[], "{\[SelectionPlaceholder]}"]}],
        MenuKey["8", Modifiers->{"Control","Command","Shift"}]],
    MenuItem["Matching [[ ]]",FrontEndExecute[{FrontEnd`NotebookApply[FrontEnd`InputNotebook[],"\[LeftDoubleBracket]\[SelectionPlaceholder]\[RightDoubleBracket]"]}], 
        MenuKey["9", Modifiers->{"Control","Command","Shift"}]],
    MenuItem["My costum format function", KernelExecute[ToExpression[myCostumTypessingFunction[]]], 
        MenuKey[".", Modifiers -> {"Control", "Command"}], MenuEvaluator -> Automatic],

This way they are also listed under the menu Insert>TypeSetting> name, along with a helpful reminder of what the shortcut key combination is. The reason for the \[SelectinPlaceholder] is so that you can select some code and use the shortcut to wrap it in parenthesis.

share|improve this answer
1  
The SelectionPlaceHolder tip is great. Thank you. –  ArgentoSapiens Feb 7 '13 at 0:50
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.