[Tex/LaTex] Writing above and below a symbol simultaneously

symbols

I'd like to have a "=" symbol with some text over it, and an equation below it. I know that \stackrel{\frac{0}{0}}{=} can handle my demand on the equation part, however I don't know how to write something more below my "=" sign at the same time.

Best Answer

I realize what I wrote is math gibberish, but I wanted to show how I've set it up so that the arguments are (by default) in math mode, which you can escape by surrounding your argument with $ signs (as I've done with the top argument). Also, you can define the stacking separation distance, as I have done (4pt above, 2pt below), since the "=" glyph comes with asymmetric space above and below it. In fact, the \DeclareMathOperator solutions provided in other solutions also does not account for this asymmetry.

The stack can account for the width of the stacked material, if that's what you want. If you wanted the equals sign alone to define the width of the stack, that can be done, too, by setting \def\useanchorwidth{T} prior to invocation. I show both possibilities below, first with the "=" defining the stackwidth, then with the over/under labels contributing to the calculation of stackwidth. Also, I revised the solution to include \mathrel{}, which adds some extra l-r spacing.

\documentclass{article}
\usepackage{stackengine}
\parskip 1em
\newcommand\stackequal[2]{%
  \mathrel{\stackunder[2pt]{\stackon[4pt]{=}{$\scriptscriptstyle#1$}}{%
  $\scriptscriptstyle#2$}}}
\begin{document}
\def\useanchorwidth{T}
\( x \stackequal{$\tiny limit$}{z\rightarrow 0} 3 \)

\def\useanchorwidth{F}
\( x \stackequal{$\tiny limit$}{z\rightarrow 0} 3 \)
\end{document}

enter image description here