Lowering second accent in mathmode

I've come to a situation where I must put a tilde/hat over the vector sign in math mode:

\begin{document} % The start of the document

$\tilde{\vec{\beta}}$

\end{document}


I find the resulting overly tall character to be a little unsightly, so I was just curious if there was a way to lower the tilde closer to the vector symbol in an aesthetically pleasing way and if I could make it into a command like:

$\vtilde{\beta}$


I attempted working through this and playing around with things but it didn't work out in my favour due to my lack of knowledge of the TeX language.

Any pointers to related resources or help would be greatly appreciated! Thanks in advance.

-
– Hendrik Vogt Aug 17 '11 at 8:59

Here is a stab at something that might work for you. Depending on taste, this may be all you're after:

\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\usepackage{calc}% http://ctan.org/pkg/calc
...
\newcommand*{\vtilde}[2][0pt]{% \vtilde[<lift>]{<stuff>}
\setbox0=\hbox{$#2$}%
\tilde{\mathrlap{\phantom{\rule{\wd0}{\ht0+{#1}}}}\smash{#2}}%
}


You would use \vtilde[<lift>]{<stuff>} where (the optional argument) <lift> is a length of how much you want to lift the \tilde above <stuff> (default is 0pt). Specifying a positive [negative] length raises [lowers] \tilde. For example,

The mathtools package is used to have access to \mathrlap, while the calc package provides calculations with lengths.

-
This is perfect! Thanks so much! – trthatcher Aug 17 '11 at 13:40
This is a very nice solution: +1. – DJP Aug 17 '11 at 15:19