Graphics, Figures & TablesEquation Alignment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Jmachin
Posts: 2
Joined: Sat Oct 29, 2011 7:06 pm

Equation Alignment

Post by Jmachin »

I'm a recently new user of LaTeX and I've just begun to use the eqnarray command. I understand that putting two "&" signs either side of my equals signs will align them together, like in the first part of my example. But I then needed some text to explain what's going on in between and so I ended my old equation array, and started a new one. I want the equals signs both above and below the text to be vertically aligned (as the red line in my example indicates). I know this is possible because I've seen it in other pdf files, but I'm not sure how / what I'm doing wrong. I attached an image of the relevant part from my PDF output. The below code is the corresponding part of my .tex file.

Code: Select all

(ii) Inductive step:
\newline Assume $A_n=0$, then:
\begin{eqnarray*}
A_{n+1}&=& (a+b)^{n+1} - \displaystyle \sum_{k=0}^{n+1} {n+1\choose k} a^{n+1-k}b^k
\\ &=& (a+b)(a+b)^n - \displaystyle \sum_{k=0}^{n+1} {n+1\choose k} a^{n+1-k}b^k
\\ &=& (a+b)\left\{\displaystyle \sum_{k=0}^{n} {n\choose k} a^{n-k}b^k\right\} - \displaystyle \sum_{k=0}^{n+1} {n+1\choose k} a^{n+1-k}b^k
\end{eqnarray*}
The previous line \emph{used} our assumption, meaning that if we arrive at a truth, we used the 'fact' that $A_n=0$ to get there. It is usually the case that we need to use the information provided in the assumption $A_n=0$ to prove that $A_{n+1}=0$.
\begin{eqnarray*}
A_{n+1}&=&\displaystyle \sum_{k=0}^{n} {n\choose k} a^{n+1-k}b^k + \displaystyle \sum_{k=0}^{n} {n\choose k} a^{n-k}b^{k+1} - \displaystyle \sum_{k=0}^{n+1} {n+1\choose k} a^{n+1-k}b^k
\end{eqnarray*}
\begin{center}\framebox{Let $k=l-1$}\end{center}
\begin{eqnarray*}
\end{eqnarray*}
\end{document}
Thanks for any help.
Attachments
latextrouble.jpg
latextrouble.jpg (74.98 KiB) Viewed 2288 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Equation Alignment

Post by shadgrind »

Instead of eqnarray* use align*, and put the text in the middle inside an \intertext command:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
 (ii) Inductive step:
 \newline Assume $A_n=0$, then:
 \begin{align*}
     A_{n+1} &= (a+b)^{n+1} - \sum_{k=0}^{n+1} {n+1\choose k} a^{n+1-k}b^k\\
     &= (a+b)(a+b)^n - \sum_{k=0}^{n+1} {n+1\choose k} a^{n+1-k}b^k\\
     &= (a+b)\left\{ \sum_{k=0}^{n} {n\choose k} a^{n-k}b^k\right\} - \sum_{k=0}^{n+1} {n+1\choose k} a^{n+1-k}b^k\\
     \intertext{The previous line \emph{used} our assumption, meaning that if we arrive at a truth, we used the 'fact' that $A_n=0$ to get there. It is usually the case that we need to use the information provided in the assumption $A_n=0$ to prove that $A_{n+1}=0$.}
     A_{n+1} &= \sum_{k=0}^{n} {n\choose k} a^{n+1-k}b^k + \sum_{k=0}^{n} {n\choose k} a^{n-k}b^{k+1} - \sum_{k=0}^{n+1} {n+1\choose k} a^{n+1-k}b^k
 \end{align*}
\end{document}
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
Jmachin
Posts: 2
Joined: Sat Oct 29, 2011 7:06 pm

Re: Equation Alignment

Post by Jmachin »

Oh ok that makes sense, thanks a lot!
Post Reply