# A nice-looking \widetilde

In this question a nice custom \widehat is made. The relevant code is below. I wanted to use this code to make a similar one for \widetilde but replacing \widehatsym by \widetildesym does not work. Since I have zero knowledge of the subtleties of tex I am stuck at this point. How does one modify this code to get a \widetilde?

    \documentclass{article}
\usepackage{amsmath,accents}
\DeclareMathSymbol{\widehatsym}{\mathord}{largesymbols}{"62}
\newcommand\lowerwidehatsym{%
\text{\smash{\raisebox{-1.3ex}{%
$\widehatsym$}}}}
\newcommand\fixwidehat[1]{%
\mathchoice
{\accentset{\displaystyle\lowerwidehatsym}{#1}}
{\accentset{\textstyle\lowerwidehatsym}{#1}}
{\accentset{\scriptstyle\lowerwidehatsym}{#1}}
{\accentset{\scriptscriptstyle\lowerwidehatsym}{#1}}
}

\begin{document}
$\fixwidehat{k}\fixwidehat{M}\fixwidehat{x}$

$\fixwidehat{abc}$
$\fixwidehat{ab}^{\fixwidehat{ab}}$
\end{document}


\documentclass{article}
\usepackage{amsmath,accents}

\DeclareMathSymbol{\widetildesym}{\mathord}{largesymbols}{"65}
\newcommand\lowerwidetildesym{%
\text{\smash{\raisebox{-1.3ex}{%
$\widetildesym$}}}}
\newcommand\fixwidetilde[1]{%
\mathchoice
{\accentset{\displaystyle\lowerwidetildesym}{#1}}
{\accentset{\textstyle\lowerwidetildesym}{#1}}
{\accentset{\scriptstyle\lowerwidetildesym}{#1}}
{\accentset{\scriptscriptstyle\lowerwidetildesym}{#1}}
}

\begin{document}

$\fixwidetilde{k}\fixwidetilde{M}\fixwidetilde{x}$

$\fixwidetilde{abc}$
$\fixwidetilde{ab}^{\fixwidetilde{ab}}$

\end{document}

• Do you mind telling me the principle behind the ''65 change? – Orn Arnaldsson Nov 25 '16 at 20:24
• The "62 and "65 are character codes (hex). I just looked them up by running a grep command for widetilde on the whole LaTeX distribution. But they can also be found in The TeXbook, page 432. – Pieter van Oostrum Nov 25 '16 at 22:11