5
$\begingroup$

I frequently need to type in some matrices, and the menu command Insert>Table/Matrix>New... allows matrices with lines drawn between columns and rows, which is very helpful. I would like to make a keyboard shortcut for it, but cannot find the relevant frontend token command (4209405) for it. Since the FullForm[] and InputForm[] of matrices with lines drawn between rows and columns is the same as those without lines, it's hard to do this via 3rd party system-wide text expanders (e.g. autohotkey or atext on mac). How does one assign a keyboard shortcut for the menu item Insert>Table/Matrix>New..., preferably using only mathematica? Thanks!

$\endgroup$
  • $\begingroup$ If you just use the keyboard shortcut for Add Row or Add Column it will create a new matrix, but not pull up the dialog box. edit I see that isn't what you are looking for $\endgroup$ – Jason B. Feb 2 '16 at 11:08
  • $\begingroup$ @JasonB Yes, I'm aware of that. I can programmatically do the fill all and fill diagonal function in the dialogue box, but the lines between the rows and columns are really nice for my needs and I can not reproduce that without clicking the menu item. $\endgroup$ – egwene sedai Feb 2 '16 at 11:10
  • 1
    $\begingroup$ The token seems to be "CreateGridBoxDialog" $\endgroup$ – Jason B. Feb 2 '16 at 11:24
5
$\begingroup$

In the MenuSetup.tr (for linux located in the $InstallationDirectory/SystemFiles/FrontEnd/TextResources/X/ directory), I changed the line

MenuItem["&New...", "CreateGridBoxDialog"]

to read

MenuItem["&New...", "CreateGridBoxDialog", MenuKey["m", Modifiers->{"Control"}]]

and now I have the keyboard shortcut

enter image description here

But maybe it is safer to change the KeyEventTranslations.tr file, since now that I've done this I can't get the singlelaunch option to work any more - fixed via restart.

$\endgroup$
  • $\begingroup$ thanks! and sorry for the singlelaunch trouble $\endgroup$ – egwene sedai Feb 2 '16 at 11:37
  • $\begingroup$ It fixed via a restart so no worries. That is a real pain for linux, if you don't use that every time you double click a notebook it opens a new instance of Mathematica. $\endgroup$ – Jason B. Feb 2 '16 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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