# How do I put text on symbols without destroying table-form of equation?

I want to put text on top of an equality symbol AND have mulitple equations in a table-like style where all equality symbols are below each other. I have tried using \overset{ sometext }{=} from the amsmath package but this "destroyed" the arrangement as it shifted the equality symbols to make the text on top be in line with the other equality smybols:

Here my corresponding code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
x+2 &= 4-2 \\
&\overset{sometext}{=} 2
\end{align*}
\end{document}


Thank you in advance for your help.

• Welcome to TeX SX! If is is really text (and not a pure math subformula) you should use \text{some text}. This being said, for your specific problem, you can use \overset{\makebox[0pt]{some text}{=}. – Bernard Aug 18 '20 at 10:16
• IMO such annotations belong on a blackboard, not in typeset text. Write it in an explanation between the line via \intertext{sometext} – daleif Aug 18 '20 at 10:49
• Thank you Bernard and daleif! I should have specified that I meant to only put a reference of a definition on top of the equality symbol and not long text for explanation. Your suggestion works perfectly for me though, Bernard. – RomanEd Aug 18 '20 at 11:10

As long as the "sometext" text string isn't too long, the following approach may be useful. (The \downarrow symbol is optional.)

\documentclass{article}
\usepackage{mathtools} % for "\mathclap" macro
% mathtools package loads amsmath package automatically
\begin{document}
\begin{align*}
x+2 &= 4-2 \\
&\overset{\substack{%
\mathclap{\text{\tiny sometext}}\\
\downarrow}}{=} 2
\end{align*}
\end{document}