# Math typestting improper after copy and paste. Can I get Mathematica to “refresh” the entire expression?

I copied the content shown in the square brackets from that shown selected in the rounded brackets. When I pasted the content, the "hats" were misplaced, as shown in all but the first two terms of the pasted text.

The first two terms were fixed by simply copying the '^' and pasting it over itself. That causes the character to move back to its proper location.

Is there a way to get that to happen without touching each misplaced character?

This is the content being copied:

This is the content after pasting:

Here is an example from a smaller expression with the same problem:

And the cell expression:

Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{
RowBox[{
SubscriptBox["a",
RowBox[{"1", "\[InvisibleComma]", "1"}]],
OverscriptBox["\[GothicI]", "^"],
OverscriptBox["\[GothicI]", "^"]}], "+",
RowBox[{
SubscriptBox["a",
RowBox[{"1", "\[InvisibleComma]", "2"}]],
OverscriptBox["\[GothicI]", "^"],
OverscriptBox["\[GothicJ]", "^"]}], "+",
RowBox[{
SubscriptBox["a",
RowBox[{"1", "\[InvisibleComma]", "3"}]],
OverscriptBox["\[GothicI]", "^"],
CellChangeTimes->{{3.72528311041591*^9, 3.725283111409934*^9}}]


The same cell with some of the hats fixed:

And the corresponding cell expression:

 Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{
RowBox[{
SubscriptBox["a",
RowBox[{"1", "\[InvisibleComma]", "1"}]],
OverscriptBox["\[GothicI]", "^"],
OverscriptBox["\[GothicI]", "^"]}], "+",
RowBox[{
SubscriptBox["a",
RowBox[{"1", "\[InvisibleComma]", "2"}]],
OverscriptBox["\[GothicI]", "^"],
OverscriptBox["\[GothicJ]", "^"]}], "+",
RowBox[{
SubscriptBox["a",
RowBox[{"1", "\[InvisibleComma]", "3"}]],
OverscriptBox["\[GothicI]", "^"],
CellChangeTimes->{{3.72528311041591*^9, 3.725283111409934*^9}, {3.725292068048725*^9, 3.725292090693556*^9}}]


• It would be very helpful to include the Cell expression of the cell that is being copied, which can be obtained by using the menu item Cell | Show Expression. – Carl Woll Jan 18 '18 at 19:03
• It looks like the DiacriticalPositioning is getting screwed up when you paste. In addition to Carls solution you could try explicitly adding it to your expression, e.g. OverscriptBox["\[GothicI]", "^",DiacriticalPositioning->True] – Mike Honeychurch Jan 18 '18 at 21:29

This looks like an issue worth reporting to support. Here are a few workarounds:

1. Evaluate the following expression after the problematic cell:

NotebookWrite[PreviousCell[], NotebookRead@PreviousCell[]] 

Animation:

1. Use the following button to fix a cell containing the insertion point:

Button[ "Reset formatting", With[{p=ParentCell @@ SelectedCells[EvaluationNotebook[]]}, NotebookWrite[p, NotebookRead[p]] ] ]

Animation:

1. Use Cell | Show Expression and edit the contents by deleting and restoring a character.

Animation: