5

I would like to vertically align two separate equations on the same line using the align environment. My code is given below.

\begin{align*}
 (3x+4)(x-3)=0 \implies 3x-4&=0 \quad \text{or} \quad & &x-3=0 \\
                        3x&=4                           &&x=3 \\
                        x&=\frac{4}{3}                    
\end{align*}

While the two equations are vertically aligned, there is excessive white space between "or" and "x-3=0". Is it possible to remove this white space?

enter image description here

2 Answers 2

5

alignat lets you exercise more control over the horizontal space between the "columns" of equations than align does .

The following screenshot shows both the OP's align*-based solution and an alternative, alignat*-based solution.

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage{amsmath}    % for 'align*' and 'alignat*' environments

\begin{document}

\texttt{align*}
\begin{align*}
 (3x-4)(x-3)=0 \implies 3x-4&=0 \quad \text{or} \quad & x-3&=0 \\
                        3x&=4                         & x&=3 \\
                        x&=4/3                   
\end{align*}

\texttt{alignat*\{2\}}
\begin{alignat*}{2}
 (3x-4)(x-3)=0 \implies 3x-4&=0 &\quad \text{or}\quad x-3&=0 \\
                        3x&=4 &                       x&=3 \\
                        x&=4/3                    
\end{alignat*}

\end{document}
2
  • Thanks! Just one question: what does {.} next to \begin{alignat*} indicate ?
    – Bell
    Jan 25 at 5:39
  • 1
    @Bell - To quote from p. 8 of the user guide of the amsmath package: "A variant environment alignat allows the horizontal space between equations to be explicitly specified. This environment takes one argument, the number of “equation columns” (the number of pairs of right-left aligned columns; the argument is the number of pairs): count the maximum number of &s in any row, add 1 and divide by 2." In short, since there are two "math columns" in the material at hand (and the maximal number of & symbols in any row is 3), the argument of alignat* has to be 2.
    – Mico
    Jan 25 at 5:47
3

It's easier to control such complicated alignments with IEEEeqnarray from IEEEtrantools.

\documentclass{article}
\usepackage{amsmath}
\usepackage{IEEEtrantools}

\begin{document}

\begin{IEEEeqnarray*}{l C r C l c r C l}
(3x+4)(x-3)=0 & \implies & 3x-4&=&0 &\qquad\text{or}\qquad  & x-3&=&0 \\
              &          &   3x&=&4 &                       &   x&=&3 \\[1ex]
              &          &    x&=&\frac{4}{3}
\end{IEEEeqnarray*}

\begin{IEEEeqnarray*}{l C c c c}
(3x+4)(x-3)=0 & \implies & 3x-4=0 &\qquad\text{or}\qquad  & x-3=0 \\
              &          &   3x=4 &                       &   x=3 \\[1ex]
              &          &    x=\frac{4}{3}
\end{IEEEeqnarray*}

\end{document}

I added a different realization that I like better, because it doesn't try to align unrelated equals signs.

enter image description here

You can do it also without IEEEtrantools.

\documentclass{article}
\usepackage{amsmath}
\usepackage{IEEEtrantools}

\begin{document}

\begin{equation*}
(3x+4)(x-3)=0 \implies
\begin{aligned}[t]
  3x-4 &= 0 \\
    3x &= 4 \\
     x &= \frac{4}{3}
\end{aligned}
\qquad\text{or}\qquad
\begin{aligned}[t]
  x-3 &= 0 \\
    x &= 3
\end{aligned}
\end{equation*}

\begin{equation*}
(3x+4)(x-3)=0 \implies
\begin{gathered}[t]
  3x-4 = 0 \\
    3x = 4 \\
     x = \frac{4}{3}
\end{gathered}
\qquad\text{or}\qquad
\begin{gathered}[t]
  x-3 = 0 \\
    x = 3
\end{gathered}
\end{equation*}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .