[Tex/LaTex] A nice-looking \widetilde

symbols

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}

Best Answer

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