I can't answer how the association is made for the built-in operators, but I can show how to add your own. If your symbol is already an operator you can do this simply as halirutan showed.
This question may be a duplicate of How can one define an infix operator with an arbitrary unicode character? but since it admits a simpler interpretation I shall not close it as such. Drawing from both Jens' and my own answer we can do the following. It requires editing a low level system file, so make careful back-ups. The format is described in the linked Q&A.
Here I will define an entirely new operator I shall call PennyOp, with a Unicode character mapping and an input alias.
Find your UnicodeCharacters.tr
file in SystemFiles\FrontEnd\TextResources\
or using the path given by:
System`Dump`unicodeCharactersTR
(at least in version 10.1 one can also copy this file to the matching path in $UserBaseDirectory
)
and add this line:
0x20B0 \[PennyOp] ($penny$) Infix 155 None 5 5
You can then use Escpenny
Esc to enter the operator, which is recognized as such:
Adding Jens' MakeExpression
definition:
MakeExpression[RowBox[{x_, "\[PennyOp]", y_}], StandardForm] :=
MakeExpression[RowBox[{"PennyOp", "[", x, ",", y, "]"}], StandardForm]
Now:
You can define PennyOp
as you would any other Symbol:
PennyOp[n_Integer, s_String] := "" <> Riffle[Table[s, {n}], " "]
5 \[PennyOp] "word"
"word word word word word"
Presto, custom Unicode-character operator with custom precedence and binding. It will only work in the Front End however.
+
is built into the parser. When the parser sees1+2
, it converts that to a representation equivalent toPlus[1,2]
. You can't modify the parser. There are a number of operators which the parser already knows but don't have any built-in meaning (see halirutan's comment onUpperRightArrow
) This is one of your options. If you go with the Notations package, you gain some flexibilty, but you are going to rely on the front end. This package relies on box representations. $\endgroup$