Reducing vertical space in stackrel

My answer is based from a bit change of the code by the excellent user @egreg at this link: How can i shrink (or expand) the vertical spacing in \stackrel?

See the result:

enter image description here

\documentclass{article}
\newcommand{\nstackrel}{%
  \mathrel{\vbox{\offinterlineskip\ialign{%
    \hfil##\hfil\cr
    $\scriptscriptstyle\footnotemark$\cr
    \noalign{\kern-.3ex}
    $=$\cr
}}}}
\begin{document}
%
\begin{equation}
e^{i\pi} + 1 \nstackrel 0
\end{equation}
\footnotetext{this is Euler's identity.}
%
\end{document}

A stackengine approach. You can adjust the 1st argument of \stackengine from -1pt to get the desired spacing.

You can use \ftmk before other symbols, as well, e.g., + and -.

\documentclass{article}
\usepackage{stackengine}
\newcommand\ftmk[1]{\addtocounter{footnote}{-1}\ensurestackMath{%
  \stackengine{-1pt}{{}#1{}}{\footnotemark}{O}{c}{F}{F}{S}}}
\begin{document}
\begin{equation}
e^{i\pi} + 1 \ftmk= 0
\end{equation}
\footnotetext{this is Euler's identity.}
\end{document}

enter image description here