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.

I want to do what this MWE would do if the hspace{-1in} actually moved that second alignment column to the left, underneath the big quadratic formula.

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}
    \begin{alignat*}{2}
        x &= \frac{-(-13) \pm \sqrt{(-13)^2 - 4(7)(0)}}{2(7)}\\
          &= \frac{13 \pm \sqrt{169}}{14}\\
          &= \frac{13 + 13}{14}& \hspace{-1in} &\phantom{=} \frac{13-13}{14}\\
          &= \frac{26}{14}& &= \frac{0}{14}\\
          &= \frac{13}{7}& &= 0
    \end{alignat*}
\end{document}

I'm trying to get rid of the unnecessary white space, and both equations in the third line are solutions of the equation in the first line, so it makes sense to have them underneath. But I still want the left one aligned vertically with the first two equal signs and the second one aligned vertically.

Any ideas?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

You could enclose the quadratic in an rlap:

enter image description here

you could also add a horizontal space to separate out the two equations:

enter image description here

Notes:

Code:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
    \begin{alignat*}{2}
        x &= \rlap{$\displaystyle \frac{-(-13) \pm \sqrt{(-13)^2 - 4(7)(0)}}{2(7)}$}\\
        &= \frac{13 \pm \sqrt{169}}{14}\\
        &= \frac{13 + 13}{14} &&\phantom{=} \frac{13-13}{14}\\
        &= \frac{26}{14}      &&= \frac{0}{14}\\
        &= \frac{13}{7}       &&= 0
    \end{alignat*}
    \begin{alignat*}{2}
        x &= \rlap{$\displaystyle \frac{-(-13) \pm \sqrt{(-13)^2 - 4(7)(0)}}{2(7)}$}\\
        &= \frac{13 \pm \sqrt{169}}{14}\\
        &= \frac{13 + 13}{14} &\qquad&\phantom{=} \frac{13-13}{14}\\
        &= \frac{26}{14}      &&= \frac{0}{14}\\
        &= \frac{13}{7}       &&= 0
    \end{alignat*}
\end{document}

Code: (with mathtools):

\documentclass{article}

\usepackage{mathtools}% includes amsmath

\begin{document}
    \begin{alignat*}{2}
        x &= \mathrlap{\frac{-(-13) \pm \sqrt{(-13)^2 - 4(7)(0)}}{2(7)}}\\
        &= \frac{13 \pm \sqrt{169}}{14}\\
        &= \frac{13 + 13}{14} &\qquad&\phantom{=} \frac{13-13}{14}\\
        &= \frac{26}{14}      &&= \frac{0}{14}\\
        &= \frac{13}{7}       &&= 0
    \end{alignat*}
\end{document}
share|improve this answer
    
Perfect! I hadn't seen \rlap before. That's just what I needed. –  Keila Sep 25 '12 at 3:23
add comment

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.