7

Of course I can simply type the unicode ↪, but is there a operator with no built in meaning that renders like this?

The documentation guide/ArrowsAndArrowLikeForms presumably lists all arrows. If it doesn't exist, can I define Output and typesettings rules for the unicode character?

Adam
  • 3,937
  • 6
  • 22
  • 3
    I am not sure I understand your question. This character does not have any built-in meaning and can be used as a symbol with no apparent problems. What exactly are you trying to achieve? – Domen Jan 15 '22 at 23:23

1 Answers1

12

You can use an empty TemplateBox to create a new operator. For example:

CurrentValue[EvaluationNotebook[],{InputAutoReplacements,"ha"}] = TemplateBox[
    {},
    "HookRightArrow",
    DisplayFunction -> Function@"↪",
    InterpretationFunction :> Function[Sequence["~", "HookRightArrow", "~"]]
];

Then, typing x space h a space y produces:

x
Sequence["~", "HookRightArrow", "~"] y

and when evaluated yields:

HookRightArrow[x, y]

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
  • Very neat. I was familiar with defining InputAutoReplacements, but having it resolve to the symbol is very nice. – Adam Jan 16 '22 at 01:21