[Tex/LaTex] Dot notation for derivative of a vector

math-modemath-operators

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}}

    dot over vec

  2. \vec{\dot{v}}

    vec over dot

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

Best Answer

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.


About TeX's \vec macro

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

wm

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:

vec


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:

vv

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:

xvec

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.

xvec3

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’:

alphabet

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)--(\xvec@width-.05em,0);
    \draw (\xvec@width-.05em,0)--(\xvec@width-.15em, .075em);
    \draw (\xvec@width-.05em,0)--(\xvec@width-.15em,-.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.

Related Question