# \vec{p_{\bar p}} renders strangely

When I do:

\vec{p_{\bar p}}


I get:

with the \vec shifted over a bit. Why does this happen?

(Also, \vec{\mbox{p_{\bar p}}} renders identically, even though \mbox{p_{\bar p}} looks fine, which clashes with my previous mental model of \mbox – I thought that things outside the box don't really affect things inside the box; guess I'm wrong.)

-
Use \vec{p}_{\bar p} –  Marco Daniel Mar 6 '12 at 18:11
@MarcoDaniel: now you win! Its a tie! –  Gonzalo Medina Mar 6 '12 at 18:12
Sorry, I guess I wasn't quite clear. That's how I got my second image, but what if I want the \vec arrow to be shifted to the right to be centered over the entire p_p "block"? –  Ben Alpert Mar 6 '12 at 18:13
(Also not suggesting that this would be the best way to typeset this, but I'm wondering why what I tried breaks.) –  Ben Alpert Mar 6 '12 at 18:14

This seems connected to the bug already examined in the question Why do arguments to nested \tilde or \breve commands reappear when amsmath is used?

Indeed, if amsmath is not loaded, your code works fine.

The solution is to avoid nesting:

$\vec{p}_{\bar{p}}$


which is, in my opinion, more mathematically sound.

-
Gotcha, thanks for the explanation (both here and on the other question)! –  Ben Alpert Mar 6 '12 at 19:20