When one wants to typeset tilde over a character, one uses the \tilde{} command. Suppose I want to tweak that command so that it prints tilde and some additional character. How would I do that?
Ideally, I would like to know how \tilde{} is defined in TeX internals, but I do not know how to find it.
Edit based on comments below: The additional character should be in accent position as well. That is, next to the tilde.
Namely, I would like to produce something akin to the figure below, which is produced with the help of the accents package using $\accentset{\sim i}{X}$, except for the \sim replaced by tilde. (When I include tilde using \textasciitilde or \texttildelow the tilde is either too high or too low and the size of i is changed.)




\tildeis\mathaccent "707E\relax– Mar 09 '17 at 19:22\mathaccent "707E\relax, and\mathaccentis a TeX primitive. – GuM Mar 09 '17 at 19:22latexwithout file name, enter\relaxat the**prompt, and then\show\tildeat the*prompt. You will get the information that\tildeis a macro defined as\mathaccent "707E\relax. Or write\show\tildeinto a text file and run latex on it. – gernot Mar 09 '17 at 19:22fontmath.ltx. – GuM Mar 09 '17 at 19:26\tilde{}command does, that is, print a tilde over a character, but put what I additionally define next to the tilde. Next to the tilde means at the same level. – Jan Mar 09 '17 at 21:44