26

I write a vector with an arrow above the letter using \vec{p} and sometimes the vector needs to be primed using ' (or ^{\prime}, equivalently).

However, neither

\vec{p}'

enter image description here

nor

\vec{p'}

enter image description here

looks satisfactory (first option: prime dash overlaps with vector arrow, second option: arrow looks misplaced).

How would one write a primed vector?

  • If you're happy to use boldface for a vector, I would recommend \renewcommand\vec\mathbf in the pre-amble, and \vec{p}' in the document. – Niel de Beaudrap Jun 19 '13 at 16:15
  • I'd hope to stick with the arrow notation. So far, the best I got is \vec{p}^{\, \prime}, but it still doesn't look right. Maybe I'm overthinking this... Possibly decreasing the size of the prime would be an option, while increasing the spacing. – Bernd Jun 19 '13 at 16:19
  • I think that \vec{p}^{\,\prime} looks alright myself; but I suppose it depends on precisely what you want to achieve with it. Do beware overthinking it though. – Niel de Beaudrap Jun 19 '13 at 16:26
33

Priming a vector denoted with the arrow is, as you discovered, not a really good thing to do. You want to prime the letter, not the whole construction.

\documentclass{article}
\newcommand{\pvec}[1]{\vec{#1}\mkern2mu\vphantom{#1}}

\begin{document}
$\vec{p}+\pvec{p}'=\pvec{p}''$
\end{document}

enter image description here

5

Adding a small amount of space in the first option should make it better:

{\vec{p}\,}'
  • Yes, that's what I am currently doing (see my comment above). It still doesn't look perfect to me, but better indeed. – Bernd Jun 19 '13 at 16:25
3

There's a problem I don't get to understand. And it's the fact that if there are multiple atoms inside a \vec it gets recolocated. I comment a little bit here.

Disclaimer: this is not fully correct (because, for instance, the prime gets recolocated), but the fact that sometimes \vec{{}<something>} looks better than \vec{<something>} annoys me.

A possible solution is:

\let\originalvec\vec 
\renewcommand*\vec[1]{\originalvec{\kern0pt #1}}

If that's not enough, you can mix it with egreg's answer

 \newcommand*\pvec[1]{\vec{#1}\mkern1mu\vphantom{#1}}

Full compilable example

\documentclass{scrartcl}

\let\originalvec\vec
\renewcommand\vec[1]{\originalvec{\kern0pt #1}}
\newcommand*\pvec[1]{\vec{#1}\mkern2mu\vphantom{#1}}

\begin{document}
$\vec p + \pvec p' = \pvec p''$

$\vec h = \vec r \times \vec v = \vec r \times \pvec r'$
\end{document}

enter image description here

  • 1
    Appendix G of The TeXbook, rule 12 ( the rule for Acc atoms) will explain you the special treatment that nuclei consisting of a single character receive: the accent may be shifted right a bit (depending on information contained in the kerning tables associated with the \skewchar of the font of the nucleus) and, more importantly, the superscript and the subscript are positioned before the accent is superimposed. Sorry, I cannot explain better in so few keystrokes... – GuM Jul 1 '15 at 15:56

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.