Skip to main content
unicode
Source Link
Carl Woll
  • 131.7k
  • 6
  • 246
  • 359

You can setup "UsefulFunction[a, b]" to use custom infix notation "a [LeftRightArrow] b" as follows:

Needs["Notation`"];
AddInputAlias["4" -> ParsedBoxWrapper["\[LeftRightArrow]"]];ParsedBoxWrapper["↔"]];
InfixNotation[ParsedBoxWrapper["\[LeftRightArrow]"]InfixNotation[ParsedBoxWrapper["↔"], FlatJoin];

enter image description here

But using a unicode character that does not have a mathematica definition (e.g. "\[name]") such as ":27d7" gives you an error:

enter image description here

Now the syntax highlighting is broken, and that is really my question: how can you tell mathematica to correctly syntax highlight new unicode infix operators?

(Note: the messages can by avoided by adding internal information on the character as follows:

Notation`Private`internalCharacterInformation["⋗"] = {"0x2295", "Infix", "450", "None", "3", "3", "MyOp"}; InfixNotation[ParsedBoxWrapper["⋗"], FlatJoin]

Edit:

I'm now pretty sure that the answer will involve editing /Applications/Mathematica.app/SystemFiles/FrontEnd/TextResources/UnicodeCharacters.tr

and adding something like

0x22D7      \[FlatJoin]     ($fj$   $&FlatJoin;$   $\oplus$)        Infix       320     None        4       4

and then using the Notations package...

You can setup "UsefulFunction[a, b]" to use custom infix notation "a [LeftRightArrow] b" as follows:

Needs["Notation`"];
AddInputAlias["4" -> ParsedBoxWrapper["\[LeftRightArrow]"]];
InfixNotation[ParsedBoxWrapper["\[LeftRightArrow]"], FlatJoin];

enter image description here

But using a unicode character that does not have a mathematica definition (e.g. "\[name]") such as ":27d7" gives you an error:

enter image description here

Now the syntax highlighting is broken, and that is really my question: how can you tell mathematica to correctly syntax highlight new unicode infix operators?

(Note: the messages can by avoided by adding internal information on the character as follows:

Notation`Private`internalCharacterInformation["⋗"] = {"0x2295", "Infix", "450", "None", "3", "3", "MyOp"}; InfixNotation[ParsedBoxWrapper["⋗"], FlatJoin]

Edit:

I'm now pretty sure that the answer will involve editing /Applications/Mathematica.app/SystemFiles/FrontEnd/TextResources/UnicodeCharacters.tr

and adding something like

0x22D7      \[FlatJoin]     ($fj$   $&FlatJoin;$   $\oplus$)        Infix       320     None        4       4

and then using the Notations package...

You can setup "UsefulFunction[a, b]" to use custom infix notation "a b" as follows:

Needs["Notation`"];
AddInputAlias["4" -> ParsedBoxWrapper["↔"]];
InfixNotation[ParsedBoxWrapper["↔"], FlatJoin];

enter image description here

But using a unicode character that does not have a mathematica definition (e.g. "\[name]") such as ":27d7" gives you an error:

enter image description here

Now the syntax highlighting is broken, and that is really my question: how can you tell mathematica to correctly syntax highlight new unicode infix operators?

(Note: the messages can by avoided by adding internal information on the character as follows:

Notation`Private`internalCharacterInformation["⋗"] = {"0x2295", "Infix", "450", "None", "3", "3", "MyOp"}; InfixNotation[ParsedBoxWrapper["⋗"], FlatJoin]

Edit:

I'm now pretty sure that the answer will involve editing /Applications/Mathematica.app/SystemFiles/FrontEnd/TextResources/UnicodeCharacters.tr

and adding something like

0x22D7      \[FlatJoin]     ($fj$   $&FlatJoin;$   $\oplus$)        Infix       320     None        4       4

and then using the Notations package...

edited tags
Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k
edited tags
Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k
added 318 characters in body
Source Link
M.R.
  • 31.8k
  • 8
  • 96
  • 289
Loading
added 45 characters in body
Source Link
M.R.
  • 31.8k
  • 8
  • 96
  • 289
Loading
Tweeted twitter.com/#!/StackMma/status/209151461362368513
Source Link
M.R.
  • 31.8k
  • 8
  • 96
  • 289
Loading