Consider this MWE:






MWE output

As you can see, \vec is designed to typeset a vector with an arrow above the argument.

However, when we do not have a unary symbol to represent a vector (e.g. the difference between the coordinates of two points) then we can use \overrightarrow. But this notation has two problems:

  1. When we are working with long chain of numbers \overrightarrow collides with it, as shown in the example.
  2. And I think the most important: it is not consistent with \vec. Why? Because \vec stops the arrow before the subscript/superscript, but \overrightarrow continues the arrow to the end regardless of the existence or not of subscript/superscript.

Remember that we are writing vectors, no matter the length of the text that represents the vector.

What I want

With your huge help, I would like to write the following:

Example of what I want

Example 2 of what I want

Example 3 of what I want


  • 2
    You can do that e.g. with \[\overrightarrow{P_{12345}P}\!_{12345}^{\,12345678}\] but I promise you that in a few years you will find this notation awkward. – user121799 Apr 1 '19 at 23:19
  • @marmot I am not a mathematician but a student of ingeering, so the conventions are our thing. :P – manooooh Apr 1 '19 at 23:20
  • 2
    it's best to avoid the over-arrow notation, especially you need it for anything more than x – David Carlisle Apr 1 '19 at 23:20
  • 1
    Then see this comment ... ;-) – user121799 Apr 1 '19 at 23:21

This seems a really confusing (and ugly) convention, but..

enter image description here



\[\overrightarrow{\strut P_{12345}\kern\wd0}\kern-\wd0P_{12345}^{12345678}\]

  • Thanks! The original \overrightarrow stops the arrow just after the last P, and your solution stops it at the middle. How can we stop the arrow a little more to the right? – manooooh Apr 1 '19 at 23:43
  • 1
    @manooooh middle? it goes to the right edge (bar the sidebearing on the arrowhead) but use \kern1.1\wd0}\kern-1.1\wd0 if you prefer (or any other factor) – David Carlisle Apr 1 '19 at 23:46
  • @manooooh Generally I use the notation for a vector of \overline or \widebar or esvect package. – Sebastiano Apr 2 '19 at 7:42

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.