# Dot notation for derivative of a vector [closed]

If I want to use the dot notation for the time derivative of a vector is better (more common) to put the dot over the vector, or the other way around

1. \dot{\vec{v}}

2. \vec{\dot{v}}

The first says the rate of change of the vector components, and the second says a vector made from the component rates.

• This to me seems like a very good example of why it might be better to use bold for vector notation, as is the case with most textbooks, as opposed to arrows notation. Feb 9, 2012 at 22:39
• The derivative of a vector valued function does not depend on the choice of a basis. So the second notation means nothing: \vec{v} is the function that you're differentiating. Feb 9, 2012 at 22:44
• Obviously, since you are taking a derivative of a vector and the result is a vector, you should use \vec{\dot{\vec{v}}}. Feb 10, 2012 at 2:25
• Using arrows instead of a bold font is like using underlines instead of italics -- useful in handwriting, but definitely not for printing. Feb 10, 2012 at 9:31
• @PeterGrill: Ok, I guess that's a good reason, but then how do you denote matrices of vectors? Or in case you have a matrix of physical values that are usually defined with capital letters? Also, from my experience students tend to overlook more easily the fact that a quantity is a vector when it's in bold. Especially so, if they copy a formula from a textbook and make a terrible mess of whether it's a vector or the scalar value of a vector! Therefore I think the arrow notation is much more (how shall I put it?) 'poignant'. Feb 10, 2012 at 13:06

I’ve only ever seen it written with the dot above the arrow; never below it. As @PeterGrill pointed out, this might be a good case to use boldface instead of arrows.

That said, I personally feel that arrow-vectors are under-used in TeX because the default implementation (\vec) looks awful. With some tweaks, it can be made to look better.

One reason \vec looks bad is because the arrows are always the same width. Notice, for example, how \vec{w} and \vec{m} look:

The ‘m’ looks like it’s wearing a t-shirt three sizes too small, and the ‘w’ looks like it's having trouble balancing a plate on its head.

Let’s look at a more real-life example. Notice how the arrow sits too far to the right of the ‘r’ and ‘v’ below. Worse yet, the arrowheads are crooked, and the dots atop them are too high and are mis-aligned:

## Alternative 1 — esvect's \vv macro

To improve upon this, the LaTeX2e package esvect provides 8 new variants of vector styles. Shown below is style b, which in my opinion looks the best of the bunch. You can write \vv{PQ} and the arrows are automatically drawn as wide as needed. However, note that the arrows are far too wide for vector variables, and also note that the horizontal bar of the arrow is composed of multiple overlapping line segments, resulting in visible anti-aliasing rendering artifacts when viewed on the screen:

I don’t recommend using \vv unless you really like the super-wide arrows. You might also want to check out the other 7 variants.

## Alternative 2 — new macro \xvec

To address the shortcomings of \vec and \vv, here is a new command called \xvec (for lack of a better name) which measures its argument automatically and provides appropriate alignment for dots:

There are three forms:

1. \xvec{} makes an unadorned vector variable.
2. \xvec[.]{} makes a single-dotted vector variable.
3. \xvec[:]{} makes a double-dotted vector variable.

The sample file (included at the bottom of this reply) includes definitions to override TeX's default \vec (if you prefer) and also provides shortcuts \dvec and \ddvec for single- and double-dotted vectors, respectively.

Here are the 26 letters ‘a’ to ‘z’:

I’m not terribly happy with the ‘i’ and the ‘j’, but these are almost always typeset in boldface anyway—especially when used with a hat to denote unit vectors.

## Source code with examples used in this answer

\documentclass{article}

\usepackage[T1]{fontenc}  % For correct {}s in \texttt
\usepackage{amsmath}      % For better \dot placement
\usepackage[b]{esvect}    % For \vv
\usepackage{tikz}         % For arrow and dots in \xvec

% --- Macro \xvec
\makeatletter
\newlength\xvec@height%
\newlength\xvec@depth%
\newlength\xvec@width%
\newcommand{\xvec}[2][]{%
\ifmmode%
\settoheight{\xvec@height}{$#2$}%
\settodepth{\xvec@depth}{$#2$}%
\settowidth{\xvec@width}{$#2$}%
\else%
\settoheight{\xvec@height}{#2}%
\settodepth{\xvec@depth}{#2}%
\settowidth{\xvec@width}{#2}%
\fi%
\def\xvec@arg{#1}%
\def\xvec@dd{:}%
\def\xvec@d{.}%
\raisebox{.2ex}{\raisebox{\xvec@height}{\rlap{%
\kern.05em%  (Because left edge of drawing is at .05em)
\begin{tikzpicture}[scale=1]
\pgfsetroundcap
\draw (.05em,0)--(\[email protected],0);
\draw (\[email protected],0)--(\[email protected], .075em);
\draw (\[email protected],0)--(\x[email protected],-.075em);
\ifx\xvec@arg\xvec@d%
\fill(\xvec@width*.45,.5ex) circle (.5pt);%
\else\ifx\xvec@arg\xvec@dd%
\fill(\xvec@width*.30,.5ex) circle (.5pt);%
\fill(\xvec@width*.65,.5ex) circle (.5pt);%
\fi\fi%
\end{tikzpicture}%
}}}%
#2%
}
\makeatother

% --- Override \vec with an invocation of \xvec.
\let\stdvec\vec
\renewcommand{\vec}[1]{\xvec[]{#1}}
% --- Define \dvec and \ddvec for dotted and double-dotted vectors.
\newcommand{\dvec}[1]{\xvec[.]{#1}}
\newcommand{\ddvec}[1]{\xvec[:]{#1}}

\begin{document}

% --- w and m look terrible with TeX's standard \vec macro
$\stdvec{w}~\stdvec{m}$\par
\vskip2em

% --- Table comparing \vec, \vv, and \xvec
\begin{tabular}{rcc}
\texttt{\scriptsize\char92 vec} &
$\stdvec{r} = \frac{1}{2}\dot{\stdvec{v}}t^2 + \stdvec{v}t$ &
$\stdvec{v}~\dot{\stdvec{v}}~\ddot{\stdvec{v}}$ \\[.75em]
\texttt{\scriptsize\char92 vv} &
$\vv{r} = \frac{1}{2}\dot{\vv{v}}t^2 + \vv{v}t$ &
$\vv{v}~\dot{\vv{v}}~\ddot{\vv{v}}$ \\[.75em]
\texttt{\scriptsize\char92 xvec} &
$\vec{r} = \frac{1}{2}\dvec{v}t^2 + \vec{v}t$ &
$\xvec{v}~\xvec[.]{v}~\xvec[:]{v}$ \\[.75em]
\end{tabular}\vskip1em

% --- Table showing \xvec, \xvec[.], and \xvec[:]
\begin{tabular}{ccc}
\texttt{\tiny\char92 xvec\{v\}} &
\texttt{\tiny\char92 xvec[.]\{v\}} &
\texttt{\tiny\char92 xvec[:]\{v\}} \\[.75ex]
$\xvec{v}$ &
$\xvec[.]{v}$ &
$\xvec[:]{v}$ \\[-.5ex]
\texttt{\tiny\char92 vec\{v\}} &
\texttt{\tiny\char92 dvec\{v\}} &
\texttt{\tiny\char92 ddvec\{v\}} \\[.75ex]
\end{tabular}\vskip2em

% --- Lowercase letters a to z
$\vec{a}~\vec{b}~\vec{c}~\vec{d}~\vec{e}~\vec{f}~\vec{g}% ~\vec{h}~\vec{\imath}~\vec{\jmath}~\vec{k}~\vec{l}~\vec{m}% ~\vec{n}~\vec{o}~\vec{p}~\vec{q}~\vec{r}~\vec{s}~\vec{t}~\vec{u}% ~\vec{v}~\vec{w}~\vec{x}~\vec{y}~\vec{z}$\par

\end{document}


## Caveats

1. I have only proofed this on the screen; you may need to tweak things for print.
2. This implementation of \xvec is intended for \textstyle and \displaystyle sizes only; it will not work properly for \scriptstyle and \scriptscriptstyle.

• Hmm. It should probably be \xvec[..]{v} instead of \xvec[:]{v}. Feb 10, 2012 at 10:32
• Although this does not answer my question directly, it implies that dot goes over the vector typically. Feb 10, 2012 at 15:41
• I like this solution. I tweaked it slightly, because since I use it inside other tikz environments, your command tends to inherit things (in my case, arrowheads). Basically, the first draw command receives the [->] argument (thus the arrowheads are the same as the default for the document), and I have to change the raisebox argument to [.4ex]. I commented the other two draw commands. Dec 17, 2014 at 9:59
• Would it be possible to have a ConTeXt (or Plain TeX) version of the xvec macro ? It works well ! Jul 14, 2016 at 20:54
• I really like this solution but I've encountered a problem when using it in conjunction with \DeclareMathOperator: In my case, I declared \DeclareMathOperator{\II}{II} but \vec{\II} looks weird (the arrow is too far to the left). \vec{\mathrm{II}} looks fine, though. I suppose it's got something to do with the spacing that \DeclareMathOperator inserts. How can I fix this?
– balu
Feb 13, 2020 at 10:24

Proper vector/tensor notation in advanced dynamics handbooks and journals is still in a state of total chaos. Everyone is using his or her own undocumented notation.

The one that I have found that works the best for me is by Hassenpflug (1993) and Hassenpflug (1995). It is unfortunately very difficult to implement it in Latex (or in Word). An exercise to the reader: Typeset the following simple time derivative of a vector with respect to base s ;-)

The mattens package was developed to implement the Hassenpflug notation

\usepackage{mattens}

\begin{align*}
\aS{x}       &= \aSb{E}_s \cdot \bS{x}^s \\
\aS[\dot]{x} &= \aSb{E}_s \cdot
\left[
\bS[\dot]{x}^s + \bS{\omega}^s\times \bS{x}^s
\right]
\end{align*}


When you are giving class and writing on the blackboard you cannot use bold letters (so much for the bold vector notation). The noformat option for mattens gives

EDIT: The arrows can look a lot better with other fonts, e.g. Luicida

• I don't know about anyone else, but I think those arrows are absolutely hideous. They're far too large and come too close to the letter beneath. Those bars also see too wide to me. Feb 10, 2012 at 5:12
• @Mark S. Everitt: The arrows are the ones from the Computer Modern fonts, you can use the Esvect package for other arrow types. The bar is a matter of taste, but in this instance it has to cater for multi-letter symbols and it must form a link with the superscript indicating the spesific base Feb 10, 2012 at 5:37
• Thanks for adding the Lucida version. Much more comfortable. :) Feb 10, 2012 at 9:41
• @DanieEls: Thanks for the links to the Hassenpflug papers! :) I'll take a look at them. Fortunately my University has a subscription, otherwise I'd be cut off by Elsevier's paywall... Feb 10, 2012 at 13:13