# Various arrow shapes above letters

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.

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


-
It would be a good idea to turn your code snippet into a complete example. –  Gonzalo Medina Apr 25 '12 at 0:33
Hello @co772 and welcome to TeX.sx. We'd like to keep answers separate from questions, so it would be better if you just asked a question and then answered your own question. Self-answers are perfectly admissible, and a well-written answer may earn you additional reputation. I would also recommend that you change your title to better reflect the contents - this will make it easier for others to find your "question." You can use the edit feature to make these changes. –  Henrik Hansen Apr 25 '12 at 4:56

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:

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?

-
Why don't you convert all your text to vectors and draw it with TikZ? That way you'd have complete freedom :-) –  Stephan Lehmke Apr 25 '12 at 6:52
@StephanLehmke I tried that. Turns out that TikZ uses up all of TeX's memory after about 100 characters on a page. Actually, maybe for lectures that's enough ... hmm, I'll take another look at that idea. –  Andrew Stacey Apr 25 '12 at 6:55
I venture to bet you haven't nearly exceeded the configurable memory maximum ;-) With DocScape I have seen pdftex processes with >2G resident memory :-) :-) –  Stephan Lehmke Apr 25 '12 at 7:03
Then comes the problem of the memory limit of a 32bit system. Is pdftex 32bit or won't it apply? –  Henrik Hansen Apr 25 '12 at 7:09
@StephanLehmke Even just loading all the italic and normal characters hits the memory limit. I should play with lualatex (I've heard it's easier to reconfigure the memory limit) to see just how much memory it is using. I've no idea why it uses so much, but I feel that the particular use is unlikely to be used for more than a dozen characters so maybe it's not something to spend too much time on. After all, 640 characters ought to be enough for anybody. –  Andrew Stacey Apr 25 '12 at 7:12