Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If one executes the following code

SetOptions[EvaluationNotebook[], InputAliases -> {"aa" -> 

the front end will change ESC+a+a+Esc into a long expression with a placeholder. I want the placeholder selected after the replacement.

If I try to use SelectionPlaceholder, instead of Placeholder, then a character from AFunctionWithAVeryLongName gets selected.

If I try to include a tab at the end of the string,

SetOptions[EvaluationNotebook[], InputAliases -> {"aa" -> 

the tab goes in literally as a tab character, not a tab command.

Also, I want the output to have a string, say "input", in the placeholder.

enter image description here

share|improve this question
Related. The answer there by the user matTECmatica appears to answer your question. I think that code could be slightly improved, maybe also see my comment there. – Jacob Akkerboom Aug 11 '13 at 14:49
Hector, you haven't answered my question: if as I believe this is not possible from InputAliases what alternatives are acceptable to you? What about a shortcut-key, or a palette button? – Mr.Wizard Aug 12 '13 at 1:13
Unfortunately, I do not see how Mathematica would allow key modifiers for shortcuts. I am working on a palette button to be controlled by AutoHotkey. – Hector Aug 13 '13 at 13:22
Hector, I'm not sure what you mean. If you doubt it is possible to create your own keyboard shortcuts please see this search result as it surely is. Are you going to post a new question? – Mr.Wizard Aug 13 '13 at 14:11
@Mr.Wizard I am looking for shortcuts available only when a package has been loaded (as opposed to system-wide ones). Also, I will post a new question because creating palette brought new challenges. – Hector Aug 13 '13 at 14:28
up vote 5 down vote accepted

Please try:

 InputAliases -> {
   "aa" -> RowBox[{"AFunctionWithAVeryLongName", "[", "\[SelectionPlaceholder]", "]"}]

enter image description here

A placeholder with a name does not seem possible with Input Aliases.

share|improve this answer
Very nice! You were quick too :) – Jacob Akkerboom Aug 11 '13 at 14:53
Duh!, the manual does say that InputAliases accepts "strings or box expressions." – Hector Aug 11 '13 at 14:54
@Hector There are lots of things the manual says that I didn't understand until someone gave me an example, or sometimes several examples. – Mr.Wizard Aug 11 '13 at 14:56
I updated the question to make explicit the requirement on the string within the placeholder … – Hector Aug 11 '13 at 15:11
@Hector I'm not certain that is possible from an input alias (I'll be happy to see it if it is). Things like command completion templates are inserted programmatically and use e.g. SelectionMove to select the labels. At least that's my recollection. – Mr.Wizard Aug 11 '13 at 15:15

Your Answer


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.