# How to copy/paste an OverHat symbol into Microsoft Word 2010 properly?

I have problem with output traditional form of sign above the constant. When I copy/paste in word it is far away up. Is there solution for this?

 BB /: MakeBoxes[BB[n_], TraditionalForm] :=
RowBox[{SubscriptBox["\!$$\* StyleBox[OverscriptBox[ StyleBox[\"A\",\nFontFamily->\"Times New Roman\",\n\ FontWeight->\"Plain\",\nFontSlant->\"Italic\"], \"^\"],\nFontFamily\ ->\"Times New Roman\",\nFontWeight->\"Plain\",\nFontSlant->\"Italic\"\ ]$$", RowBox[{Sequence @@
Riffle[Table["\!$$\*SubscriptBox[\(c$$, $$1$$]\)", {1}], 2]}]]}]


-
It seems to me Word 2013 uses FromCharacterCode[770] instead of FromCharacterCode[94] (i.e. the ordinary ^) for the overhat. –  Silvia Feb 1 '13 at 17:24
how to fix it in word 2010? What is charactercode? –  Pipe Feb 1 '13 at 17:29
I don't have 2010 aside. But I think they can use the same MathML syntax. –  Silvia Feb 1 '13 at 17:37

I don't have a Word 2010 aside. But I think the MathML syntax would be the some. The following method works for my Word 2013.

Create the desired formula in Word with the built-in formula editor:

Then copy and paste it into Mathematica:

Check the cell expression:

Cell[BoxData[
FormBox[
TagBox[
SubscriptBox[
OverscriptBox["A", "^",
DiacriticalPositioning->True],
SubscriptBox["c", "2"]],
"MathMLPresentationTag",


So we have our magic spell, an OverscriptBox with the option of DiacriticalPositioning -> True!

Thus a definition like the following should work fine with MS Word:

BB /: MakeBoxes[BB[n_], TraditionalForm] :=
SubscriptBox[OverscriptBox["A", "^", DiacriticalPositioning -> True],
SubscriptBox["c", n]]


Simply Ctrl+c or Copy As -> MathML, then paste in Word.

-
Thank you very much Silvia! –  Pipe Feb 1 '13 at 18:20
@Pipe You're welcome :) Thanks for accepting. –  Silvia Feb 1 '13 at 18:28
Perfect, congrats. I can male similar code for brackets also? Instead of traditional form u(v(r(b))) to get this u{v[r(b)]}, I am not sure how to recognize order of brackets? Thank you very much in any case. Regards, Pipe :) –  Pipe Feb 1 '13 at 19:04
@Pipe Yes I think the principle behind is the same. MathML is a very useful intermediary for transferring formulas. –  Silvia Feb 2 '13 at 4:42