Using the Notation package, I have a custom notation defined for chemical reactions. A minimal example is below (I will explain the commented-out part in a moment):
Needs["Notation`"]
Notation[ParsedBoxWrapper[
RowBox[{"a_", TagBox["\[LongRightArrow]",
Identity, SyntaxForm -> "\[Equal]"
(*, Editable->False,Selectable->False*)
],
"b_"}]]
\[DoubleLongLeftRightArrow]ParsedBoxWrapper[
RowBox[{"LongRightArrow", "[", "a_", ",", "b_", "]"}]]]
Notation[ParsedBoxWrapper[
RowBox[{"a_", OverscriptBox[TagBox["\[LongRightArrow]", Identity,
SyntaxForm -> "\[Equal]"
(*,Editable->False,Selectable->False*)
],
"k_"],
"b_"}]]
\[DoubleLongLeftRightArrow]ParsedBoxWrapper[
RowBox[{"LongRightArrow","[","a_",",","b_",",","k_","]"}]]]
AddInputAlias["rxn" -> ParsedBoxWrapper[
TagBox["\[LongRightArrow]",Identity,SyntaxForm->"\[Equal]"
(*,Editable->False,Selectable->False*)
]]]
The first Notation entry defines a reaction with reactants and products. The second Notation entry defines a reaction with reactants and products, and a rate constant that is positioned over the arrow. The TagBox is needed in order to change the precedence of LongRightArrow so that the parser doesn't swap around reactants and products. You can enter an example reaction like this:
The problem is that on either side of the long right arrow there are two cursor positions, which I presume represent being inside the tagbox and outside the tagbox. Entering reactants or products within the tagbox, or going to the overscript box from within the tagbox breaks the Notation assignments, so I would like to eliminate those as possible cursor locations. See below:
I did something similar for a complex symbols package I have put together using the Editable->False, Selectible->False approach within a style definition, but here it doesn't seem to work (decomment the commented-out portions above to try). Further, if I replace the TagBox with a TemplateBox and apply the style I used previously, I still end up with two distinct regions the cursor can be outside the arrow.
Any suggestions? Thanks!