Per this question, I have created a custom graphical control object which evaluates to a list of values. I would like to be able to create such an object quickly, rather than typing some command, pressing shift+enter, then copying the resulting object into wherever I want to use it. For example, something like typing \[Theta] which turns into θ... is it possible to create such a custom shorthand notation? (Even better, is it possible that when I start to type in a function which takes such a list as arguments, it pops up this control object for me to type the values in?)


Assuming you are referring to this control. You can

  • Evaluate in a separate cell each time and copy paste (you don't like this)
  • Write the command and evaluate in place
  • Copy the control once and paste it several times: remember the variables were localized so each will have its own copy and they won't interfere
  • Create a palette

    CreatePalette@PasteButton["Paste control", myControl["a"~CharacterRange~"g"]];
  • Create a toolbar

    AppendTo[CurrentValue[InputNotebook[], DockedCells], 
       ToBoxes@PasteButton["Paste control", 
  • Create an input alias, or an input auto replacement. Example of input alias (the other one is the same)

    AppendTo[CurrentValue[InputNotebook[], InputAliases], 
     "control" -> ToBoxes@myControl["a"~CharacterRange~"g"]]
  • $\begingroup$ Thanks, this lead me to find InputAutoReplacements which was what I wanted. Do you have any idea why it selects a random field/object in the box instead of highlighting the first text field when the replacement happens? $\endgroup$
    – jtbandes
    Nov 24 '12 at 1:05
  • $\begingroup$ @jtbandes not off the top of my head. Generally \[SelectionPlaceholder]s are used to represent where the selection will go so you could try initializing the control with that character $\endgroup$
    – Rojo
    Nov 24 '12 at 19:12

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.