# Reducing vertical space in stackrel

I often use the stackrel command within an equation in the following way

\documentclass{article}
\begin{document}
%
$$e^{i\pi} + 1 \stackrel{\footnotemark}{=} 0$$
\footnotetext{this is Euler's identity.}
%
\end{document}


I'd like to reduce the vertical distance between the footnotemark and the equal sign by default. How can I do it?

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:

\documentclass{article}
\newcommand{\nstackrel}{%
\mathrel{\vbox{\offinterlineskip\ialign{%
\hfil##\hfil\cr
$\scriptscriptstyle\footnotemark$\cr
\noalign{\kern-.3ex}
$=$\cr
}}}}
\begin{document}
%
$$e^{i\pi} + 1 \nstackrel 0$$
\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}
$$e^{i\pi} + 1 \ftmk= 0$$