6

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?

athos
  • 807
  • 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 02:44
  • 4
    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 02:47

5 Answers5

8

Less is sometimes more. Consider this merely a suggestion:

enter image description here

\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}
Werner
  • 603,163
  • 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 02:16
6

Prettiest of all ;-)

\documentclass{article}
\begin{document}
\[
  y \stackrel{t=x^n}{=\joinrel=\joinrel=} x
\]
\end{document}
JPi
  • 13,595
1

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}

enter image description here

0

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}

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

\end{document}

output

0

With aligned equal signs:

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

\end{document}

enter image description here