3

Consider the following screenshot. I want to vertically align the left = as shown in the expected part.

\documentclass[border=12pt,preview]{standalone}
\usepackage{amsmath}
\begin{document}
\abovedisplayskip=0pt\relax
\begin{align*}
    a_1=4   &= 4 + 3 \times 0 \\
    a_2=7   &= 4 + 3 \times 1 \\
    a_3=10  &= 4 + 3 \times 2 \\
    a_4=13  &= 4 + 3 \times 3 \\
    a_5=16  &= 4 + 3 \times 4 \\
    a_6=19  &= 4 + 3 \times 5 \\
    a_7=22  &= 4 + 3 \times 6 
\end{align*}
\end{document}

enter image description here

Display Name
  • 46,933

3 Answers3

4

This will work:

\documentclass[border=12pt,preview]{standalone}
\usepackage{amsmath}
\begin{document}
\abovedisplayskip=0pt\relax
\begin{align*}
    a_1&=\phantom{0}4   = 4 + 3 \times 0 \\
    a_2&=\phantom{0}7   = 4 + 3 \times 1 \\
    a_3&=10  = 4 + 3 \times 2 \\
    a_4&=13  = 4 + 3 \times 3 \\
    a_5&=16  = 4 + 3 \times 4 \\
    a_6&=19  = 4 + 3 \times 5 \\
    a_7&=22  = 4 + 3 \times 6 
\end{align*}
\end{document}
3

With alignat:

\documentclass[border=12pt,preview]{standalone}
\usepackage{amsmath}

\begin{document}

\abovedisplayskip=0pt\relax \begin{alignat}{2} a_1 & =&4 &= 4 + 3 \times 0 \ a_2 & = & 7&= 4 + 3 \times 1 \ a_3 & ={}&10 &= 4 + 3 \times 2 \ a_4 & = &13 &= 4 + 3 \times 3 \ a_5 & = &16 &= 4 + 3 \times 4 \ a_6 & = &19 &= 4 + 3 \times 5 \ a_7 & = &22 &= 4 + 3 \times 6 \end{alignat}

\end{document}

enter image description here

Bernard
  • 271,350
3

You can use either alignat or array.

The first solution has already been proposed; I use {} after every &= for uniformity, even if just one would suffice.

Using array spares this and the result is the same. On the other hand, array would be much easier if you also need other alignment points, say to go up to a11

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}

\begin{alignat}{2} % R L R L a_1 &={} & 4 &= 4 + 3 \times 0 \ a_2 &={} & 7 &= 4 + 3 \times 1 \ a_3 &={} & 10 &= 4 + 3 \times 2 \ a_4 &={} & 13 &= 4 + 3 \times 3 \ a_5 &={} & 16 &= 4 + 3 \times 4 \ a_6 &={} & 19 &= 4 + 3 \times 5 \ a_7 &={} & 22 &= 4 + 3 \times 6 \end{alignat}

\begin{equation} \renewcommand{\arraystretch}{1.2} \setlength{\arraycolsep}{0pt} \begin{array}{@{} l >{{}}c<{{}} r >{{}}l @{}} a_1 &= & 4 &= 4 + 3 \times 0 \ a_2 &= & 7 &= 4 + 3 \times 1 \ a_3 &= & 10 &= 4 + 3 \times 2 \ a_4 &= & 13 &= 4 + 3 \times 3 \ a_5 &= & 16 &= 4 + 3 \times 4 \ a_6 &= & 19 &= 4 + 3 \times 5 \ a_7 &= & 22 &= 4 + 3 \times 6 \end{array} \end{equation}

\end{document}

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}

\begin{equation} \renewcommand{\arraystretch}{1.2} \setlength{\arraycolsep}{0pt} \begin{array}{@{} l >{{}}c<{{}} r >{{}}l @{}} a_1 &= & 4 &= 4 + 3 \times 0 \ a_2 &= & 7 &= 4 + 3 \times 1 \ a_3 &= & 10 &= 4 + 3 \times 2 \ a_4 &= & 13 &= 4 + 3 \times 3 \ a_5 &= & 16 &= 4 + 3 \times 4 \ a_6 &= & 19 &= 4 + 3 \times 5 \ a_7 &= & 22 &= 4 + 3 \times 6 \ a_{11} &= & 34 &= 4 + 3 \times 10 \end{array} \end{equation}

\end{document}

enter image description here

egreg
  • 1,121,712