# Alignment on character that has an overscript

We can align to a character:

Column[{"a \[LongRightArrow] c", "2 a \[LongRightArrow] c + 3",
"a + b + c \[LongRightArrow] e"},Alignment -> "\[LongRightArrow]"]


But not if that character has an overscript:

Column[{"a \!$$\*OverscriptBox[\(\[LongRightArrow]$$, $$k$$]\) c",
"2 a \!$$\*OverscriptBox[\(\[LongRightArrow]$$, $$k$$]\) c + 3",
"a + b + c \!$$\*OverscriptBox[\(\[LongRightArrow]$$, $$k$$]\) e"},
Alignment -> "\[LongRightArrow]"]


Does anyone have thoughts on how to accomplish that goal?

Edited to Add: Ok, my context is a bit more complicated than this, and apparently I left out something critical. Using the Notation package:

Notation[ParsedBoxWrapper[RowBox[{"a_",TemplateBox[{}, "Reaction",
DisplayFunction->("\[LongRightArrow]"&),
SyntaxForm->"\[Equal]"],"b_"}]]\[DoubleLongLeftRightArrow]
ParsedBoxWrapper[RowBox[{"LongRightArrow","[","a_",",","b_","]"}]]]
Notation[ParsedBoxWrapper[RowBox[{"a_",
OverscriptBox[TemplateBox[{}, "Reaction",
DisplayFunction->("\[LongRightArrow]"&),
SyntaxForm->"\[Equal]"],"k_"],"b_"}]]\[DoubleLongLeftRightArrow]
ParsedBoxWrapper[RowBox[{"LongRightArrow",
"[","a_",",","b_",",","k_","]"}]]]
DisplayFunction->("\[LongRightArrow]"&), SyntaxForm->"\[Equal]"]]]


And the usage is here:

The top definitions are easiest to type. The bottom definitions are clearest to copy-and-paste:

rxnlist = {LongRightArrow[a, c], LongRightArrow[2 a, c + 3],
LongRightArrow[a + b + c, 3]}
rxnlist2 = {LongRightArrow[a, c, k1], LongRightArrow[2 a, c + 3, k2],
LongRightArrow[a + b + c, e, k3]}

Column[rxnlist, Alignment -> "\[LongRightArrow]"]
Column[rxnlist2, Alignment -> "\[LongRightArrow]"]


And it turns out that even the top version doesn't work in this formulation.

So what I am looking for is a way to modify my notation statements in a way that will make this work (without sacrificing the reasons that I set them up that way in the first place, which would take a while to explain), or, better yet, a way to take the data structures I already have and align them.

• Just use GridBox. I think if you're plumbing this deep into Notation and needing edge cases for it, you may want to consider just doing all the formatting with MakeBoxes and the box language yourself. "Notation" is nice for quick-and-dirty solutions, but isn't flexible enough to really warrant using it. You can do everything notation can do by hand if you know how the FE works. – b3m2a1 Jul 25 '19 at 21:08
• Thing is, I am designing a system that allows people who are only minimally-proficient in Mathematica to use it for complex, domain-specific problems while giving them the ability to solve those problems in notation that is extremely close to what they are used to (which is quite distinct from MMA's native notation). And I have gotten quite far in that already! See this for some examples: kevinausman.net/home/chemistry-package/equilibria – Kevin Ausman Jul 25 '19 at 21:14
• I don't think you need to use Notation for that. You as the developer can do it right and simply provide them with the nice interface. – b3m2a1 Jul 25 '19 at 21:15

doc

use AlignmentMarker (by esc-am-esc) before the arrow and change Alignment accordingly?

Column[{"a \
\[AlignmentMarker]\!$$\*OverscriptBox[\(\[LongRightArrow]$$, $$k$$]\) \
c", "2 a \[AlignmentMarker]\!$$\*OverscriptBox[\(\[LongRightArrow]$$, \
$$k$$]\) c + 3",
"a + b + c \
\[AlignmentMarker]\!$$\*OverscriptBox[\(\[LongRightArrow]$$, $$k$$]\) \
e"}, Alignment -> "\[AlignmentMarker]"]


EDIT

If you only want to see the output, you may try using latex with MaTeX:

<< "MaTeX"

eqn[l_, r_, a_] :=
ToString[l] <> "&\\xrightarrow{~\\text{" <> ToString[a] <> "}~}" <>
ToString[r];
l2 = {eqn[a, c, k1], eqn[2 a, c + 3, k2], eqn[a + b + c, e, k3]};
l2lx = StringRiffle[l2, "\\\\"];
MaTeX["\\begin{aligned}" <> l2lx <> "\\end{aligned}"]


• Hmmmm. I like the idea in general, but I don't know that I can make that work in my context. (That's the problem with trying to find a minimal working example... I seem to end up leaving out something that I didn't realize was important.) My LongRightArrows are part of a DisplayFunction in a TemplateBox as I use the Notation package. And the TemplateBox is inside an OverscriptBox. If I put the AlignmentMarker inside the DisplayFunction, I run into the same problem as above. If I put it outside the OverscriptBox, it becomes selectable (and thus deleteable) by my users. I will modify the OP. – Kevin Ausman Jul 25 '19 at 19:21
• @KevinAusman If you only want to see the output, you may try my edit above using latex/matex – egwene sedai Jul 25 '19 at 20:42
• @KevinAusman or, put each element in a grid, akin to Grid[{{a, b, c}, {dddd, e, ffffff}, {11, 2, 3333}}, Alignment -> {{Right, Center, Left}}]` – egwene sedai Jul 25 '19 at 20:52