# How to vertically align multiple equations with text underset?

How do you vertically align equality signs when one of them has some text underset? My solution is:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[american]{babel}

\usepackage{amsmath}

\begin{document}
\begin{align*}
a &\underset{\text{explanation}}{=} b + c\\
d &\underset{\phantom{\text{explanation}}}{=} e + f + d
\end{align*}
\end{document}


However, that's not very elegant especially when several \underset are involved.

-
Are you actually referring to horizontal alignment? –  Werner Apr 18 '12 at 22:48

The result is not particularly pleasing. If you don't need equation numbers, then an array can do:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[american]{babel}

\usepackage{amsmath,array}

\begin{document}
\begin{align*}
a &\underset{\text{explanation}}{=} b + c\\
d &\underset{\phantom{\text{explanation}}}{=} e + f + d
\end{align*}

$\renewcommand{\arraystretch}{1.5}\setlength{\arraycolsep}{0pt} \begin{array}{r >{{}}c<{{}} l} a &\underset{\text{explanation}}{=} & b + c\\ d &= & e + f + d \end{array}$
\end{document}


-
Thanks for your help. Equation numbers would be nice to have. But I see, it's not trivial. I just tried to work with alignat but couldn't find a solution. Another solution is to use \mathclap around the text, but then of course the word extends over the left- and right-hand side -- which is ugly, too. –  Marius Hofert Apr 19 '12 at 5:43
@MariusHofert I really would try a different way; usually the explanation is set to the side of the formula. –  egreg Apr 19 '12 at 7:43
What if you have several equations in a line (because they are short and you don't want to waste space -- as on slides, for example), but you want to address a specific equation? (the problem came up like this on the slides I use to teach). But thanks, anyway. –  Marius Hofert Apr 19 '12 at 11:31

I use \stackrel to put text above arrows and stuff. I confess that I'm not sure, but I think it's part of the amsmath package. Try

$\stackrel{-\frac{1}{6} R_3}{\longrightarrow}$


Maybe this helps.

-