[Tex/LaTex] How to get a dot over a vector

accentsmath-mode

I would like to combine, somehow, \vec{x} and \dot{x} so that I get an x with a vector arrow over it and a dot over that. Any suggestions?

Best Answer

How about the obvious, i.e. $\dot{\vec{a}}$? Spacing is a little off... which could be fixed by using the esvect package (for vectors in general) and using:

\documentclass{minimal}

\usepackage{esvect}

\begin{document}
$\dot{\vv{a}}$
\end{document}  

Result using first solution is on left hand side, using esvect is on right hand side:

result


UPDATE:
I added a little solution of my own which has good spacing and uses the normal latex vector arrow [but requires the accents package]. This can be obtained using the command \DotVec (no need for an additional \vec; code:

\usepackage{accents}
\newcommand*{\DotVec}[1]{%
  \accentset{\mbox{\hspace{0.25ex}.}}{\ensuremath{\vec{#1}}}}  

I created a document for comparing my solution, the "plain" latex solution and @Eddy_Em's [I hope that's okay?] solution. Code is:

\documentclass{minimal}

%% solution using esvect
\usepackage{esvect}

%% required for looping all letters
\usepackage{pgffor}

%% my solution using the accents package
\usepackage{accents}
\newcommand*{\DotVec}[1]{%
  \accentset{\mbox{\hspace{0.25ex}.}}{\ensuremath{\vec{#1}}}}

%% this is Eddy_Em's solution
\newsavebox{\hght}
\def\dotvec#1{\savebox{\hght}{$\vec{#1}$}\dot{\raisebox{0pt}[.8\ht\hght]{$\vec{#1}$}}}

%% this is used for a little extra vertical space in the below listing
\def\vSpacer{\vrule height 15pt width 0pt}

\begin{document}
\noindent
Order is:
\begin{verbatim*}
\dot{\vec{a}} \dot{\vv{a}} \dotvec{a} \DotVec{a}
\end{verbatim*}
For roman alphabet:\\[5pt]

\par\noindent
\foreach \l in {a,...,z} {%
    \vSpacer $\dot{\vec{\l}} \; \dot{\vv{\l}} \; \dotvec{\l} \; \DotVec{\l},\quad$
}

\par\noindent
\foreach \l in {A,...,Z} {%
    \vSpacer $\dot{\vec{\l}} \; \dot{\vv{\l}} \; \dotvec{\l} \; \DotVec{\l},\quad$
}

\end{document}  

Resulting document:

result

Zoom for letter a:

zoom