4

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?

David Carlisle
  • 757,742
Keila
  • 581
  • 3
  • 11

1 Answers1

7

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}
Moriambar
  • 11,466
Peter Grill
  • 223,288