[Tex/LaTex] Must be equal and other stacked math symbols

amsmathmath-mode

Several times already I wanted to express something like

  !
A = B

or

   n->0
X ------> oo

in a math environment. How do I achieve this?

On a related note: What is the correct term for this? Googling for ! and = unsurprisingly doesn't yield too many useful results.

Best Answer

In the code below, I create a new command, \mbeq (short for "must be equal"...), which is a "math relational" operator (same type as the "ordinary" equal sign). Using the \overset command in the definition of the \mbeq operator automatically makes the new command "inherit" the type of the second argument of the \overset command; hence, it's not necessarily to assign the type "mathrel" explicitly.

\documentclass{article}
\usepackage{amsmath}
 % "mbeq": must be equal
\newcommand{\mbeq}{\overset{!}{=}}
\begin{document}
$ a\mbeq b$, $x\xrightarrow{n\to 0}\infty$
\end{document}

enter image description here

Finally, I'm not aware of a commonly used term for the "must be equal" symbol (exclamation mark set over equality symbol). I searched detexify, and no predefined symbol came up.

Related Question