[Tex/LaTex] Various arrow shapes above letters

arrowstikz-pgf

I needed to type vectors with bend arrows, (in the debate arrow- bold, I vote for arrow). I did not find anything about that on internet (wording problem may be) but the closest I found was Dot notation for derivative of a vector [closed].

Therefore I am not sure it has any interest for anybody else, but if it has, I slightly modified the code given by Todd Lehman in the above question to get the result on the picture.

enter image description here

\usepackage{tikz}         % For arrow and dots in \xvec
\usetikzlibrary{arrows}
% --- Macro \pvec - (pseudo vector)
%Note that the percent after \rlap should NOT be deleted (just try it...)
\makeatletter
\newlength\pvec@height
\newlength\pvec@depth
\newlength\pvec@width
\newcommand{\pvec}[2][]{
    \settoheight{\pvec@height}{$#2$}
    \settodepth{\pvec@depth}{$#2$}
    \settowidth{\pvec@width}{$#2$}
  \def\pvec@arg{#1}
  \raisebox{.2ex}{\raisebox{\pvec@height}{\rlap{% 
    \kern.05em
    \begin{tikzpicture}[scale=1,shorten >=-3pt,shorten <=-3pt]
    \pgfsetroundcap
    \coordinate (Stx) at (.05em,0) ;
    \coordinate (Arx) at (\pvec@width-.05em,0) ;
    \draw[->](Stx) to[bend right] (Arx);
    \end{tikzpicture}
  }}}
  #2
}
\makeatother

Posted, just in case it helps…

A complete MWE:

% ----------------------------------------------------------------
% Article Class (This is a LaTeX2e document)  ********************
% ----------------------------------------------------------------
\documentclass[12pt]{article}
%\usepackage[english]{babel}
%\usepackage{amsmath,amsthm}
%\usepackage{amsfonts}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage{tikz}         % For arrow and dots in \xvec
\usetikzlibrary{arrows}
% --- Macro \pvec - (pseudo vector)
%Note that the percent after \rlap should NOT be deleted (just try it...)
\makeatletter
\newlength\pvec@height
\newlength\pvec@depth
\newlength\pvec@width
\newcommand{\pvec}[2][]{%
    \settoheight{\pvec@height}{$#2$}
    \settodepth{\pvec@depth}{$#2$}
    \settowidth{\pvec@width}{$#2$}
  \def\pvec@arg{#1}
  \raisebox{.2ex}{\raisebox{\pvec@height}{\rlap{%
    \kern.05em
    \begin{tikzpicture}[scale=1,shorten >=-3pt,shorten <=-3pt]
    \pgfsetroundcap
    \coordinate (Stx) at (.05em,0) ;
    \coordinate (Arx) at (\pvec@width-.05em,0) ;
    \draw[->](Stx) to[bend right] (Arx);
    \end{tikzpicture}
  }}}
  #2
}

\newcommand{\pvecl}[2][]{%                   % for downward arrow
    \settoheight{\pvec@height}{$#2$}
    \settodepth{\pvec@depth}{$#2$}
    \settowidth{\pvec@width}{$#2$}
  \def\pvec@arg{#1}
  \raisebox{.2ex}{\raisebox{\pvec@height}{\rlap{%
    \kern.05em
    \begin{tikzpicture}[scale=1,shorten >=-3pt,shorten <=-3pt]
    \pgfsetroundcap
    \coordinate (Stx) at (.05em,0) ;
    \coordinate (Arx) at (\pvec@width-.05em,0) ;
    \draw[->](Stx) to[bend left] (Arx);
    \end{tikzpicture}
  }}}
  #2
}
\makeatother

% ----------------------------------------------------------------
\begin{document}
$\pvec{a}\qquad$ $\qquad\pvec{OA}$ $\qquad\pvecl{OA}$
\newline

Quaternions: $\qquad\pvecl{q_{r}} = s + \vec{v}, \pvecl{Q} $
\newline

Pseudo vectors: $\qquad\pvec{a}\qquad$ $\qquad\pvec{OA}$

% ----------------------------------------------------------------
\end{document}
% ----------------------------------------------------------------

enter image description here

Best Answer

I would like to be able to draw more complicated arrows above letters than are available with the usual maths commands. I feel that, for example, a curved arrow over a quaternionic vector would better express the fact that a (unit) quaternion represents a rotation in 3-space. Moreover, being able to distinguish between types of vector based on the shape of the arrow above would make it easier for students to keep track of what is what in lecture slides. When combined with the techniques of Can I change the font and colour of a letter permanently? then I think this would have the potential to make my lectures really stand out.

I guess I'd like something that looks like this:

curved arrows

I already load TikZ in all my documents (whether they use it or not) so a TikZ-based solution would be ideal. Does anyone happen to have any code lying around that would do this?