The Problem:

I don't know about you, but every time I am trying to do analytical work in Mma, it is rather difficult/cumbersome for me to type the following, here specifically for \[DoubleStruckN]:


The Ask:

It would be really cool, convenient, and neat if we could easily make some shortcuts like we do here!

Something like Ctrl+Command(Alt)+n for \[DoubleStruckN] and Ctrl+Command(Alt)+Shift+n for \[DoubleStruckCapitalN] would be extra neat.

I know that I could manually input all of my desired shortcuts for \[DoubleStruckLetters] literally line-by-line into the KeyEventTranslations.tr file, but it is easy to make a small mistake in syntax along the way, and I am very very very VERY lazy and I like the automated aspect of Mathematica!

Pure (function) and simple, I really don't feel like we should have to manually add this, at least line-by-line, to the KeyEventTranslations.tr file, which is located here on Windows 10:


From which you should copy over (before making any modifications) to your $UserBaseDirectory located here, again on Windows 10, noting that you likely must add the Windows folder if this is your first time modifying the KeyEventTranslations.tr file:


How can we do this?

Some Useful References/Custom Shortcuts:

@b3m2a1's answers here are especially useful, though they do not illustrate a nice, easy, and automated way to make all of the alphas one would want to use, though they do provide some exceptionally keen methods to add new menus & other useful items:

While this is an edit after the self-answer, I do not understand the methods that @b3m2a1 uses for these automations, though perhaps they are willing to answer this with an update based on the current self-answer's automated method and force me to not be able to accept my own self-answer [;

tl;dr neither of the currently proposed methods are complete, teamwork is key, this can be very beneficial to accomplish with ease and simplicity, please help!

5/5 hits! YOU SUNK MY BATTLESHIP! D; Look's like @b3m2a1's package is worthy of this being marked a duplicate, though you won't find this addition/functionality available there (yet! [;) when it is, I will mark it down on the post there, and then here also. Previous complaints of a prideful programmer: Kind of confused why this is being closed instead of answered, as this method is not elsewhere, and I think being able to add other custom mappings internally has been requested for a while, only to show the most basic of modifications...Can any of you provide a good answer to this? This is immensely useful for me so far...would love to see this automated! So far, while @b3m2a1 has some really, and I do mean really, really great QnAs that touch on this subject, there is still not a method like this available! Please don't close this useful & currently well-researched post, instead maybe someone can expand on this or show us the answer! Pretty please with bounties on top?

  • 5
    $\begingroup$ Possible duplicate of Best way to add KeyEvents and faster Quit, especially @b3m2a1's answer. $\endgroup$
    – Carl Woll
    Jun 2, 2019 at 20:31
  • $\begingroup$ I’ll add it as a reference, but this is far from a duplicate. Adding KeyEvents all carry the same syntax, sure, but this is....definitely new ;D and not a duplicate by any means—though @b3m2a1’s answer is purdy neat, but not what this does [else it should be edited to note this technique and set of convenient(ish) key-mappings having existed beforehand!!] ;D $\endgroup$ Jun 2, 2019 at 20:33
  • $\begingroup$ @CarlWoll I added the reference and indicated why it would not work for what this is asking for! Is it possible to not vote to close this based on an initial confusion? $\endgroup$ Jun 2, 2019 at 20:42
  • $\begingroup$ @CarlWoll while exceptionally neater and requiring far more skill than what I've asked for here, adding a new menu is not what this asked for, and so is not a duplicate! Is there some more specific wording I should use to make this evidently clear? $\endgroup$ Jun 2, 2019 at 20:45
  • $\begingroup$ @b3m2a1, would you be able to provide an epic answer for this semi-vital addition in functionality-for-the-lazy-and-typo-ridden among us? $\endgroup$ Jun 2, 2019 at 23:21

1 Answer 1


How we can do this:

We will make an automated parser for these modifications, as stated!
Let's see what we have here, shall we?

The Answer:

Mathematica is very powerful if used correctly and consise-ish-ly.
So, as we can for many other things, we can programmatically generate these modifications like you will find below, noting that one would simply exchange \[Gothic or \[Formal for \[DoubleStruck within the following code, inserting it, as before, after the EventTranslations[{ line.

I recommend commenting it up like the base file is, in order to separate out your custom shortcuts from those that were there before. I won't do this for you, because, again, I'M LAZY, TOO! But, I'm too nice, so you can copy the "example" here below, to easily follow the predetermined format:

(* Custom DoubleStruck Shortcuts*)

The Solution:

abc = Alphabet[];
        Item[KeyEvent[\"" <> abc[[#]] <> 
    "\", Modifiers ->{Control, Command}],
                " <> ToString["\"\[DoubleStruck"] <> Capitalize[abc[[#]]] <> 
    ToString["]\""] <> ", After]
        Item[KeyEvent[\"" <> abc[[#]] <> 
    "\", Modifiers ->{Control, Command, Shift}],
                " <> ToString["\"\[DoubleStruckCapital"] <> 
    Capitalize[abc[[#]]] <> ToString["]\""] <> ", After]
        }]]" & /@ Range@Length@abc, ","]

Now, you'll just highlight the entire output, and, at least for Windows, right-click and select Copy As> Plain Text, copy this to your KeyEventTranslations.tr file,


WOW! It sure is as easy as abc[[#]]&/@Range[3], hey?

Sorta. ;D


Also, If anyone has even less time than I do, they are also more than welcome to make more of these automated parsers for the other letters, but honestly, those shortcuts aren't terribly cumbersome, though it would be super duper extra neat to see this work for the Greek (and Cyrillic!!) letter-like inputs, wink-wink, if, say, one had those international keymappings memorized and did not feel like switching keyboards during their work!

Find the notebook file in the following locations:

I swear I'll cross-post this to Community after my actual work is done tomorrow afternoon, probably!

  • 1
    $\begingroup$ This can done properly dynamically (e.g. sans restart) by adding the edits to the menu. That can be regenerated and rebound on the fly. I did this e.g. here. Also, if you want to mess around with KeyEventTranslations.tr you can do that programmatically too via some similar code to that CustomKeyEvents.wl code I wrote up, but instead pasting the edits into a KeyEventTranslations.tr file in $UserBaseDirectory (always make edits in $UserBaseDirectory). This is easier and less error prone than copy-paste and much safer, too. $\endgroup$
    – b3m2a1
    Jun 4, 2019 at 6:11
  • $\begingroup$ Definitely! Thank you for responding!! :) I’d love to see this adapted into a smoother packaged form like you do (I just was happy I got it to parse it all automatically, to prevent the typographical errors you warned of. The $UserBaseDirectory is what is recommended here for that purpose (though I still got mma to break when I would forget a bracket) What exactly do you mean “sans restart”? I only ask as I never restarted my machine during the process, just would close mma then open it as (I assumed) that is the normal process to have it reinitialize and detect changes in the users .tr file $\endgroup$ Jun 4, 2019 at 11:02
  • $\begingroup$ @b3m2a1 so rereading this your suggestion is exactly what this already does? [; just without the comma which I mentioned in big bold letters ((mma will let you know upon its next launch(when you test your adds) that you did not make it happy)) I am excited to branch your github with this new & added functionality! I am confused, and I want to learn, you say we can paste into the .tr file, is this programmatically? Then you advise against copy-paste, as done above? If we can avoid the need to select plaintext upon copy-paste, and add a binding swapper, this will be great to add to your package! $\endgroup$ Jun 4, 2019 at 12:45

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