Tell me more ×
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.

Look at the following example

\begin{align}
     & x \\
     \overset{\text{some long explanation}}= & foo \\
     & = bar
\end{align}

what is the best way to get the equal signs aligned? Now I have seen different solution such as adding \overset{\hphantom{\ţext{some long explanation}}}= to the beginning of every line, but I don't really think that is the best solution. Any better ideas?


UPDATE

I guess what i am actually after is

  1. aligning the first column of the align environment right
  2. aligning the equal sign under the overset text right
share|improve this question
1  
Please correct your current code snippet, since I assume you're after some horizontal alignment. You just mention "align" but provide a horizontally set align. At the moment it's not entire clear what you're after. – Werner Jan 7 '12 at 15:50
yes. I guess what you mean where the missing \\s? – niklasfi Jan 7 '12 at 16:18
If you modify \mathclap in Herbert's answer to \mathllap, you get something more in line with what you're after. If this is still not the case, could you include an ASCII art (or some other drawing/image) of the exact alignment you're after? – Werner Jan 7 '12 at 17:09

2 Answers

you say you don't want to repeat "some long explanation", but there really isn't any better way to do it that i know of.

is this what you're after?

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
 x &\overset{\text{some long explanation}}= foo \\
   &\overset{\phantom{\text{some long explanation}}}= bar
\end{align}
\end{document}
share|improve this answer
\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{align}
  x & \\
    &\overset{\mathclap{\strut\text{some long explanation}}}= foo\\
    & = bar
\end{align}

\end{document}
share|improve this answer
this leads to some long text floating into the formula after the equal sign – niklasfi Jan 7 '12 at 16:39

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.