[Tex/LaTex] add (a little bit long) comment on the equal sign

math-modestacking-symbolssyntax

There are posts here explained how to Add a comment on top of "equal" and "approximate" symbols , the idea is to use \stackrel{text}{=}, however, if the text is a bit long, for example I'd like to right

LHS\stackrel{t=x^n}{=}RHS

then the text over the equal symbol is a bit too long.

How could I make it more pretty?

Best Answer

Prettiest of all ;-)

\documentclass{article}
\begin{document}
\[
  y \stackrel{t=x^n}{=\joinrel=\joinrel=} x
\]
\end{document}