2
$\begingroup$

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]}]]}]

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

1 Answer 1

5
$\begingroup$

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:

Mathematica graphics

Then copy and paste it into Mathematica:

Mathematica graphics

Check the cell expression:

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

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]]

Mathematica graphics

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

$\endgroup$
3
  • $\begingroup$ @Pipe You're welcome :) Thanks for accepting. $\endgroup$
    – Silvia
    Commented Feb 1, 2013 at 18:28
  • $\begingroup$ 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 :) $\endgroup$
    – Pipe
    Commented Feb 1, 2013 at 19:04
  • $\begingroup$ @Pipe Yes I think the principle behind is the same. MathML is a very useful intermediary for transferring formulas. $\endgroup$
    – Silvia
    Commented Feb 2, 2013 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.