# add (a little bit long) comment on the equal sign?

There are posts here explained how to Add a comment on top of "equal" and "approximate" symbols , the idea is to use \stackrel{text}{=}, however, if the text is a bit long, for example I'd like to right

LHS\stackrel{t=x^n}{=}RHS


then the text over the equal symbol is a bit too long.

How could I make it more pretty?

• You could always try turnstile with null verticals. \turnstile{n}{d}{}{t=x^n}{n}, for example. (The package automatically adjusts the horizontal lines to the size of whatever is placed over and/or under them.) – cfr Jul 29 '14 at 2:44
• The best thing to do here is not to do that; surely there's a better way to indicate what you want to express than overloading the equality symbol. – Gonzalo Medina Jul 29 '14 at 2:47

## 5 Answers

Prettiest of all ;-)

\documentclass{article}
\begin{document}
$y \stackrel{t=x^n}{=\joinrel=\joinrel=} x$
\end{document}


Less is sometimes more. Consider this merely a suggestion:

\documentclass{article}
\begin{document}
It is obvious that
$LHS \stackrel{*}{=} RHS$
where $\stackrel{*}{=}$ denotes an equality based on the fact that $t = x^n\!$.
\end{document}

• thanks for the suggestion. I'll adopt your approach however take @JPi 's reply as the (literal) answer to the question. – athos Aug 14 '14 at 2:16

The stackengine package has a parameter \def\useanchorwidth{} that when set to T, ignores the stacked-on or -under content when determining the width of the stack. The optional argument provides the stacking gap. A {}={} had to be used to get the stacked equal sign to act as a math relation.

\documentclass{article}
\usepackage{stackengine}
\stackMath
\begin{document}
\def\useanchorwidth{T}
$LHS\stackunder[1pt]{{}={}}{\scriptstyle t=x^n}RHS$\par\medskip
$y\stackon[4pt]{{}={}}{\scriptscriptstyle blah-blah}A x^2 +Bx +c$
\end{document}


With aligned equal signs:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\Huge
$LHS\,\stackrel{\mathllap{t}=\mathrlap{x^n}}{=}\,RHS$

\end{document}


This is somewhat similar to Werner's suggestion but with the additional use of \mathclap and \smash:

\documentclass{article}

\usepackage{mathtools}

\newcommand*\Ref[2]{\stackrel{\mathclap{\scriptscriptstyle\smash{(#1)}}}{#2}}
\newcommand*\RefEq[1]{\ensuremath{(#1)}}

\begin{document}

$$A \Ref{\triangle}{=} B$$
From \RefEq{\triangle} we see that $A = B$.

\end{document}