4
$\begingroup$

When I write:

Overscript[PQ, \[RightVector]], 

the arrow is placed too close to the P and Q. Is there a way to modify the default distance used by Overscript?

$\endgroup$
2
  • $\begingroup$ Quick fix is to select PQ or overscript and ALT+UpArrow/DownArrow. $\endgroup$
    – Kuba
    Aug 5, 2013 at 11:29
  • $\begingroup$ @kuba ...also the best fix $\endgroup$ Aug 5, 2013 at 12:15

1 Answer 1

8
$\begingroup$

I see the problem of close spacing only for OverVector, not for the input with Overscript (where in your example I had to add quotation marks around the arrow symbol to avoid getting an error).

So I'm now assuming you're actually referring to the following issue:

OverVector[PQ]

vec

This could be remedied by adding an AdjustmentBox around the arrow with the help of a formatting command like this:

OverVector /: MakeBoxes[OverVector[x_], _] := 
 OverscriptBox[ToBoxes[x], 
  AdjustmentBox["\[RightVector]", BoxBaselineShift -> -0.5]]

OverVector[PQ]

vec2

This enlarged spacing will work by default in StandardForm and TraditionalForm output.

Edit

For backward compatibility with Mathematica version 7, Mr. Wizard pointed out that it's good to add another option:

OverVector /: MakeBoxes[OverVector[x_], _] := 
 OverscriptBox[ToBoxes[x], 
  AdjustmentBox["\[RightVector]", BoxBaselineShift -> -0.5, 
   BoxMargins -> {{0, 0}, {0.5, 0}}]]
$\endgroup$
1
  • 1
    $\begingroup$ @Mr.Wizard Yes, that seems to cover all versions and works fine. I also just checked that it works in version 9. $\endgroup$
    – Jens
    Aug 7, 2013 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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