# \dot over \vec over : amsmath bug/feature?

I was trying to typeset the time derivative of \vec{r}_\alpha, and naively, I put it as an argument to \dot. This does not work: the arrow is not on r anymore. Here is a minimal example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\dot{\vec{r}_\alpha}$
\end{document}


Note that there is a better way to typeset it (and it works): \dot{\vec{r}}_\alpha. I am asking out of curiosity.

-
I'd use all sorts of "beautifiers" (\dot, \hat, etc.) only on the main symbol (in your case, "r") and not on the whole object (r_\alpha). Unless the \dot is e.g. absolute time derivative, or a similar operator that is to be applied on the whole term. –  Martin Tapankov Jan 25 '11 at 13:14
from physical view it is wrong to have the dot over r and alpha. It should only be over the r, the reason why your own solution is the only correct one. –  Herbert Jan 25 '11 at 13:44
@Herbert, I of course agree that the correct thing to do is \dot{\vec{r}}_\alpha. I was mostly asking because amsmath changes the output unexpectedly. –  Bruno Le Floch Jan 25 '11 at 13:56
you are absolutely right, it should work ... –  Herbert Jan 25 '11 at 15:03

Have a look at the mattens package. I have written it to "overcome" these problems

\documentclass{article}
\usepackage{mattens} % use [noformat] for non-bold symbols
\usepackage{bm}
\begin{document}
$\aS[\Dot]{r}_\alpha$

or some other examples where \TeX\ makes a real mess on its own

$\bS[\Dot]{f}^i_j$
\end{document}

-
Hmm, again: Can you explain what you mean, please? If I replace amsmath with mattens, I get the same problems. –  Hendrik Vogt Jan 25 '11 at 15:20
@Hendrik: See the example in updated post –  Danie Els Jan 25 '11 at 15:44
sorry, which updated post? –  Bruno Le Floch Jan 25 '11 at 16:17
@Bruno: He refers to the code in this answer. –  Hendrik Vogt Jan 25 '11 at 17:14
@Hendrik: for some reason the edited post had not appeared yet when I posted my comment. @Danie. Thanks: although your answer does not solve my question of putting a dot on \vec{r}_\alpha, it is probably the most useful for future users. –  Bruno Le Floch Jan 25 '11 at 17:29
To me it looks like a bug: It works as expected if you omit \usepackage{amsmath}. However, it's somewhat strange what you're trying to do. You should not expect \dot{\vec{r}_\alpha} and \dot{\vec{r}}_\alpha to produce the same output; in the first case, the \dot should be centered over \vec{r}_\alpha, and over \vec{r} in the second case:
And I have no idea why you'd want to achieve the first version: If you want the \dot over everything, then maybe you should also put the \vec over everything, as in \dot{\vec{r_\alpha}}. This again works with amsmath.
As to why amsmath changes things (see comment below): amsmath contains a fix for producing nice double accents, and this seems to go wrong here. (Incidentally, you get almost the same unexpected behaviour if you use accents instead of amsmath.)
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 2, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9303427934646606, "perplexity": 1736.0678679712473}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-15/segments/1397609539447.23/warc/CC-MAIN-20140416005219-00275-ip-10-147-4-33.ec2.internal.warc.gz"}