3

I am having problems center text that has been aligned. For some reason the second align is not centered. Here is an image of the output.Output

Below is my code...

words
\begin{align*}
    1&=ak_1+bl_1\\
    n&=n(ak_1+bl_1)\\
    &=nak_1+nbl_1\\
    &=ak_n+bl_n\\
\end{align*}
words
\begin{align*}
    n&=ak_n+bl_n\\
    &=ak_n+abx+bl_n-abx\\
    &=a(k_n+bx)+b(l_n-ax)\\
    &=ar+bs&\\
\end{align*}
more words
4
  • 1
    Welcome to TeX.SE.For star try to omit last `\` in your equations. They introduce additional vertical space shich seems to be your problem..
    – Zarko
    May 20, 2016 at 17:08
  • 2
    Welcome! You have a trailing &\\ in the second alignment: remove it.
    – egreg
    May 20, 2016 at 17:11
  • 1
    Welcome to LaTeX! Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. May 20, 2016 at 17:11
  • 1
    What's the second & in the final line of the second align* environment supposed to achieve?
    – Mico
    May 20, 2016 at 17:11

2 Answers 2

1

A mentioned in my comment, the last line in your aligned equations have surplus \\- Also in secon groupu of equations is one ampersund to much ... Try

\documentclass{article}
\usepackage{mathtools}
\usepackage{lipsum}

    \begin{document}
\lipsum[2]
\begin{align*}
1   & = ak_1+bl_1           \\
n   & = n(ak_1+bl_1)        \\
    & = nak_1+nbl_1         \\
    & = ak_n+bl_n
\end{align*}
\lipsum[2]
\begin{align*}
n   & = ak_n+bl_n           \\
    & = ak_n+abx+bl_n-abx   \\
    & = a(k_n+bx)+b(l_n-ax) \\
    & = ar+bs
\end{align*}
\lipsum[2]
    \end{document}

enter image description here

0

You have an improper & in the last line of the second alignment, which sets up a second set of alignments; those columns are empty, but the space between the first and the second set is accounted for.

You also have trailing \\ that should be removed.

Original

\documentclass{article}
\usepackage{amsmath}

\usepackage{showframe} % just for the example

\begin{document}

words
\begin{align*}
    1&=ak_1+bl_1\\
    n&=n(ak_1+bl_1)\\
    &=nak_1+nbl_1\\
    &=ak_n+bl_n\\
\end{align*}
words
\begin{align*}
    n&=ak_n+bl_n\\
    &=ak_n+abx+bl_n-abx\\
    &=a(k_n+bx)+b(l_n-ax)\\
    &=ar+bs&\\
\end{align*}
more words

\end{document}

enter image description here

Fixed version

\documentclass{article}
\usepackage{amsmath}

\usepackage{showframe} % just for the example

\begin{document}

words
\begin{align*}
    1&=ak_1+bl_1\\
    n&=n(ak_1+bl_1)\\
    &=nak_1+nbl_1\\
    &=ak_n+bl_n
\end{align*}
words
\begin{align*}
    n&=ak_n+bl_n\\
    &=ak_n+abx+bl_n-abx\\
    &=a(k_n+bx)+b(l_n-ax)\\
    &=ar+bs
\end{align*}
more words

\end{document}

enter image description here

Note

The frame is just for demonstration purposes. Don't load the showframe package yourself.

You must log in to answer this question.

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