I am having really hard time to figure out how to adjust the length of \leadsto arrow in order to match the text above it. The command I am using is
\newcommand{\transitb}[1]{\stackrel{#1}{\leadsto}_{\pi\gamma}}
and here is the output I get:
I found this as an answer: leadsto with text but I don't want to mess my equation with some tikz stuff.
Is there a simple way to do what I am looking for?
EDIT:
Here is the output I get when I try this How do I put text over a squiggly arrow?

EDIT2
When Trying to use it in beamer within definition block I go the following error:
Missing $ inserted
Any thoughts on what could cause this error.

\textwidthand\parskip, neither of which have anything to do with the operation of the solution. Their change, however, could wreak havoc with your document, if you tried to copy/paste my result into your document. So you would want to remove those settings. – Steven B. Segletes Feb 24 '16 at 15:15amsmathcauses the behavior you observe. I will work to fix that. – Steven B. Segletes Feb 24 '16 at 15:33stackengine, by default, stacks text, not math. In the cited MWE, I issued a\stackMathin the preamble to tellstackengineto stack math, not text, by default. If your application stacks both math and text at different points in the document, one can keep the text stacking as the default, and employ\ensurestackMath{...}as needed. – Steven B. Segletes Mar 03 '16 at 10:49