# [Tex/LaTex] How to vertically align multiple equations with text underset

alignvertical alignment

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.

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}


Top your code, bottom mine: