Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Are you actually referring to horizontal alignment? –  Werner Apr 18 '12 at 22:48

2 Answers 2

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:

enter image description here

share|improve this answer
    
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.