Typeset an = with an ! above

That's very easy. And there are at least two identical solutions.

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}
 \[
   a\stackrel{!}{=} b   % from vanilla LaTeX
 \]

 \[
   a\overset{!}{=} b    % from »amsmath«
 \]
\end{document}

Both give identical output in this case but \overset should be preferred because it takes care of operator spacing.


\stackrel#1#2

is the command you search.

\stackrel{!}{=}

will lead to the sign you want to typeset. The first argument sits on top of the second argument, where the first one is smaller than the second one.


If you needed to customize the separation between the overset, here's a way it could be done. The default is 3pt, halfway between the two examples shown.

\documentclass[11pt]{article}
\usepackage{stackengine}
\begin{document}
\[
 a \mathrel{\stackon[5pt]{$=$}{$\scriptstyle!$}} b
\quad
 a \mathrel{\stackon[1pt]{$=$}{$\scriptstyle!$}} b
\]
\end{document}

enter image description here